Beispiel #1
0
func SetDoorOpen(value bool) {
	if value {
		C.io_set_bit(C.LIGHT_DOOR_OPEN)
	} else {
		C.io_clear_bit(C.LIGHT_DOOR_OPEN)
	}
}
Beispiel #2
0
func Set_button_light(button int, floor int, value bool) {
	channel := C.int(encode_light(button, floor))
	if value {
		C.io_set_bit(channel)
	} else {
		C.io_clear_bit(channel)
	}
}
Beispiel #3
0
func SetFloorIndicator(floor int) bool {
	if floor < 0 || floor > 3 {
		return false
	}

	if (floor & 0x02) != 0 {
		C.io_set_bit(C.LIGHT_FLOOR_IND1)
	} else {
		C.io_clear_bit(C.LIGHT_FLOOR_IND1)
	}

	if (floor & 0x01) != 0 {
		C.io_set_bit(C.LIGHT_FLOOR_IND2)
	} else {
		C.io_clear_bit(C.LIGHT_FLOOR_IND2)
	}

	return true
}
Beispiel #4
0
func RunTopFloor() {
	if GetFloorSignal() != 3 {
		C.io_clear_bit(C.MOTORDIR)
		//time.Sleep(time.Second * 1)
		C.io_write_analog(C.MOTOR, 2800)
		for C.io_read_bit(C.SENSOR_FLOOR4) == 0 {
			SetFloorIndicator(GetFloorSignal())
			time.Sleep(time.Millisecond * 200)
		}
		SetFloorIndicator(GetFloorSignal())
		C.io_write_analog(C.MOTOR, 0)
	}
}
Beispiel #5
0
func Io_clear_bit(channel int) {
	C.io_clear_bit(C.int(channel))
}
Beispiel #6
0
func ioClearBit(channel int) {
	C.io_clear_bit(C.int(channel))
}
Beispiel #7
0
func RunUp() {
	C.io_clear_bit(C.MOTORDIR)
	//time.Sleep(time.Second * 1)
	C.io_write_analog(C.MOTOR, 2800)
}
Beispiel #8
0
func IO_Clear_Bit(channel int) {
	C.io_clear_bit(C.int(channel))
}
Beispiel #9
0
func io_clearBit(channel int) {
	_, err := C.io_clear_bit(C.int(channel))
	checkError(err)
}