Example #1
0
func init() {
	driver.ElevInit()
	driver.ElevSetMotorDirection(1)

	for {
		if driver.ElevGetFloorSensorSignal() >= 0 {
			driver.ElevSetMotorDirection(0)
			break
		}
	}
}
Example #2
0
func main() {
	Driver.ElevInit()
	localStatusCh := make(chan Elev_control.Elevator, 10)
	sendBtnCallCh := make(chan [NUMBUTTONS - 1]int, 10)
	errorCh := make(chan int)
	receiveAllBtnCallsCh := make(chan [NUMFLOORS][NUMBUTTONS - 1]bool, 10)
	setLights_setExtBtnsCh := make(chan [4][2]bool, 10)

	go Elev_control.Run_Elevator(localStatusCh, sendBtnCallCh, receiveAllBtnCallsCh, setLights_setExtBtnsCh, errorCh)
	go Master_Slave.Run_MasterSlave_Logic(localStatusCh, sendBtnCallCh, receiveAllBtnCallsCh, setLights_setExtBtnsCh, errorCh)
	checkForError(errorCh)
	callBackup := exec.Command("gnome-terminal", "-x", "sh", "-c", "go run main.go")
	callBackup.Run()
}
Example #3
0
func initMain() {
	driver.ElevInit()
	driver.ElevSetMotorDirection(1)
	var previousFloor = -1

	for {
		if driver.ElevGetFloorSensorSignal() >= 0 {
			driver.ElevSetMotorDirection(0)
			previousFloor = driver.ElevGetFloorSensorSignal()
			fmt.Println("I've reached floor", previousFloor)
			break
		}
	}
}
Example #4
0
func main() {
	driver.ElevInit()
	driver.ElevSetMotorDirection(0)
}