Ejemplo n.º 1
0
/*
	This functions checks the sensor at a
	given floor to see if the elevator is at that floor.
*/
func checkFloor() int {
	if driver.IOReadBit(SENSOR_FLOOR1) {
		return 0
	} else if driver.IOReadBit(SENSOR_FLOOR2) {
		return 1
	} else if driver.IOReadBit(SENSOR_FLOOR3) {
		return 2
	} else if driver.IOReadBit(SENSOR_FLOOR4) {
		return 3
	} else {
		return -1
	}
}
Ejemplo n.º 2
0
/*
	This functions loops through the different types of buttons at all the
	floors and checks if any buttons are pressed.
*/
func checkButtonPressed(buttonType, floor int) bool {
	// TODO -> Do this better in terms of counter variable names and button types. Can this function be removed?
	if driver.IOReadBit(buttonChannelMatrix[floor][buttonType]) {
		return true
	} else {
		return false
	}
}
Ejemplo n.º 3
0
/*
	This function checks the status of the obstruction button/signal
*/
func checkObstructionSignal() bool {
	return driver.IOReadBit(OBSTRUCTION)
}
Ejemplo n.º 4
0
/*
	This function checks the status of the stop button
*/
func checkStopSignal() bool {
	return driver.IOReadBit(STOP)
}