예제 #1
0
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()
	}
}
예제 #2
0
파일: fsm.go 프로젝트: kairobert/Prosjekt
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")
}
예제 #3
0
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()
}
예제 #4
0
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()
	}

}
예제 #5
0
파일: fsm.go 프로젝트: kairobert/Prosjekt
func (elev *Elevator) action_stop() {
	elevdriver.MotorStop(elev.motorChan)
	elev.state = EMG
}