Phil Howard | 6577b7e | 2016-03-09 12:19:22 +0000 | [diff] [blame] | 1 | import wiringpi |
White Moustache | c464261 | 2016-02-13 14:17:08 +0000 | [diff] [blame] | 2 | PIN_TO_SENSE = 23 |
| 3 | |
| 4 | def gpio_callback(): |
| 5 | print "GPIO_CALLBACK!" |
| 6 | |
Phil Howard | 6577b7e | 2016-03-09 12:19:22 +0000 | [diff] [blame] | 7 | wiringpi.wiringPiSetupGpio() |
| 8 | wiringpi.pinMode(PIN_TO_SENSE, wiringpi.GPIO.INPUT) |
| 9 | wiringpi.pullUpDnControl(PIN_TO_SENSE, wiringpi.GPIO.PUD_UP) |
White Moustache | c464261 | 2016-02-13 14:17:08 +0000 | [diff] [blame] | 10 | |
Phil Howard | 6577b7e | 2016-03-09 12:19:22 +0000 | [diff] [blame] | 11 | wiringpi.wiringPiISR(PIN_TO_SENSE, wiringpi.GPIO.INT_EDGE_BOTH, gpio_callback) |
White Moustache | c464261 | 2016-02-13 14:17:08 +0000 | [diff] [blame] | 12 | |
| 13 | while True: |
Phil Howard | 6577b7e | 2016-03-09 12:19:22 +0000 | [diff] [blame] | 14 | wiringpi.delay(2000) |