collab/pb-hal

git clone https://git.julia.blue/collab/pb-hal

Rahul ButaniRestructuringce16264

imu
422 B20 linesraw
1import wiringpi
2PIN_TO_SENSE = 23
3
4count = 0
5
6def gpio_callback():
7    global count
8    count += 1
9#    print("GPIO_CALLBACK!")
10
11wiringpi.wiringPiSetupGpio()
12wiringpi.pinMode(PIN_TO_SENSE, wiringpi.GPIO.INPUT)
13wiringpi.pullUpDnControl(PIN_TO_SENSE, wiringpi.GPIO.PUD_UP)
14
15wiringpi.wiringPiISR(PIN_TO_SENSE, wiringpi.GPIO.INT_EDGE_BOTH, gpio_callback)
16
17while True:
18    wiringpi.delay(2000)
19    print("Yo")
20    print(count)