Testing wiringPi2 interrupts on python 2.7 / RaspberryPi and doesn't seem to make it work.
In the following code, the interrupt generates a segmentation error.
#!/usr/bin/env python2 import wiringpi2 import time def my_int(): print('Interrupt') wpi = wiringpi2.GPIO(wiringpi2.GPIO.WPI_MODE_PINS) wpi.pullUpDnControl(4,wpi.PUD_UP) wpi.wiringPiISR(4, wpi.INT_EDGE_BOTH, my_int()) while True: time.sleep(1) print('Waiting...') Waiting... Waiting... Waiting... Waiting... Segmentation fault
If I callback without "()", then I get another error:
wpi.wiringPiISR(4, wpi.INT_EDGE_BOTH, my_int) > TypeError: in method 'wiringPiISR', argument 3 of type 'void (*)(void)'
What am I doing wrong?
source share