Skip to content

Commit 74718d2

Browse files
nalajciebkrepo
authored andcommitted
examples: wiringPiISR usage example
1 parent 5ed67f0 commit 74718d2

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎examples/callback.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)