Example #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)
	}
}
Example #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)
	}
}
Example #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
}
Example #4
0
func RunBottomFloor() {
	if GetFloorSignal() != 0 {
		C.io_set_bit(C.MOTORDIR)
		//time.Sleep(time.Second * 1)
		C.io_write_analog(C.MOTOR, 2800)
		for C.io_read_bit(C.SENSOR_FLOOR1) == 0 {
			SetFloorIndicator(GetFloorSignal())
			time.Sleep(time.Millisecond * 200)
		}
		SetFloorIndicator(GetFloorSignal())
		C.io_write_analog(C.MOTOR, 0)
	}
}
Example #5
0
func Io_set_bit(channel int) {
	C.io_set_bit(C.int(channel))
}
Example #6
0
func ioSetBit(channel int) {
	C.io_set_bit(C.int(channel))
}
Example #7
0
func RunDown() {
	C.io_set_bit(C.MOTORDIR)
	//time.Sleep(time.Second * 1)
	C.io_write_analog(C.MOTOR, 2800)
}
Example #8
0
func IO_Set_Bit(channel int) {
	C.io_set_bit(C.int(channel))
}
Example #9
0
func io_setBit(channel int) {
	_, err := C.io_set_bit(C.int(channel))
	checkError(err)
}