1 parent 5ed67f0 commit 74718d2Copy full SHA for 74718d2
1 file changed
examples/callback.py
@@ -0,0 +1,14 @@
1
+import wiringpi2
2
+PIN_TO_SENSE = 23
3
+
4
+def gpio_callback():
5
+ print "GPIO_CALLBACK!"
6
7
+wiringpi2.wiringPiSetupGpio()
8
+wiringpi2.pinMode(PIN_TO_SENSE, wiringpi2.GPIO.INPUT)
9
+wiringpi2.pullUpDnControl(PIN_TO_SENSE, wiringpi2.GPIO.PUD_UP)
10
11
+wiringpi2.wiringPiISR(PIN_TO_SENSE, wiringpi2.GPIO.INT_EDGE_BOTH, gpio_callback)
12
13
+while True:
14
+ wiringpi2.delay(2000)
0 commit comments