func (elevinf *Elevatorinfo) StopMotor() { if elevinf.last_direction == 1 { elevdriver.MotorDown() time.Sleep(10 * time.Millisecond) elevdriver.MotorStop() fmt.Printf("Stopping...\n") } else if elevinf.last_direction == 2 { elevdriver.MotorUp() time.Sleep(10 * time.Millisecond) fmt.Printf("Stopping...\n") elevdriver.MotorStop() } }
func (elev *Elevator) action_halt_n_exec() { elevdriver.MotorStop(elev.motorChan) elevdriver.OpenDoor() //start_timer() //order_executed() elev.state = DOORS_OPEN elevdriver.SetLight(elev.lastFloor, elev.lastDir) fmt.Println("fsm: DOORS_OPEN") }
func (elevator *Elevatorinfo) StopButtonPushed() { elevdriver.SetStopButton() fmt.Printf("Stop button has been pushed...\n") for i := 0; i < 4; i++ { for j := 0; j < 3; j++ { elevator.internal_orders[i][j] = 0 } } elevdriver.MotorStop() }
func StartMotor(direction int) { if direction == -1 { elevdriver.MotorDown() fmt.Printf("Elevator going down...\n") } else if direction == 1 { elevdriver.MotorUp() fmt.Printf("Elevator going up...\n") } else if direction == -2 || direction == 2 { elevdriver.MotorStop() } }
func (elev *Elevator) action_stop() { elevdriver.MotorStop(elev.motorChan) elev.state = EMG }