/* 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 } }
/* 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 } }
/* This function checks the status of the obstruction button/signal */ func checkObstructionSignal() bool { return driver.IOReadBit(OBSTRUCTION) }
/* This function checks the status of the stop button */ func checkStopSignal() bool { return driver.IOReadBit(STOP) }