예제 #1
0
def sensor_if():
    global sensor_infrared
    if GPIO.IN(infrared) == 1:
        sensor_infrared = True
    elif GPIO.IN(infrared) == 0:
        sensor_infrared = False
    else:
        print("infrared sensor error")
    pass
예제 #2
0
def my_callback(channel):
    GPIO.setmode(GPIO.BCM) # Not sure why I have to redo this part....???
    GPIO.setup(9,GPIO.IN)
    global int_step
    print(str(GPIO.IN(9)))
    rx_buf[int_step] = GPIO.input(9)
    int_step+=1
    if(int_step==9):
        int_step = 0