mirror of
git://soft.sys114.com/WiringPi2-Python
synced 2026-02-11 12:00:26 +09:00
examples: wiringPiISR usage example
This commit is contained in:
committed by
nalajcie
parent
96d5dcd9ae
commit
c4642616b3
14
examples/callback.py
Normal file
14
examples/callback.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import wiringpi2
|
||||||
|
PIN_TO_SENSE = 23
|
||||||
|
|
||||||
|
def gpio_callback():
|
||||||
|
print "GPIO_CALLBACK!"
|
||||||
|
|
||||||
|
wiringpi2.wiringPiSetupGpio()
|
||||||
|
wiringpi2.pinMode(PIN_TO_SENSE, wiringpi2.GPIO.INPUT)
|
||||||
|
wiringpi2.pullUpDnControl(PIN_TO_SENSE, wiringpi2.GPIO.PUD_UP)
|
||||||
|
|
||||||
|
wiringpi2.wiringPiISR(PIN_TO_SENSE, wiringpi2.GPIO.INT_EDGE_BOTH, gpio_callback)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
wiringpi2.delay(2000)
|
||||||
Reference in New Issue
Block a user