White Moustache | c464261 | 2016-02-13 14:17:08 +0000 | [diff] [blame] | 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) |