I am stuck with the wait_for_edge function in a Python RPi package
. I added a few event detections for gpio to crash, and everything works fine as long as the callback functions do not contain a command, e.g.
os.system("mpc pause")
Then the script crashes with the error message: "RunetimeError: error # 5, waiting for the edge" Does anyone know what this error message wants to say? Or where can I look for such things?
To be specific, this code works:
def next(channel):
print "In next"
GPIO.add_event_detect(buttonnext,GP.FALLING,callback=next,bouncetime=200)
os.system("mpc play")
try:
GPIO.wait_for_edge(buttonstop, GP.FALLING)
os.system("mpc stop")
except KeyboardInterrupt:
GPIO.cleanup()
os.system("mpc stop")
GPIO.cleanup()
But this code does not:
def next(channel):
print "In next"
os.system("mpc next")
GPIO.add_event_detect(buttonnext,GP.FALLING,callback=next,bouncetime=200)
os.system("mpc play")
try:
GPIO.wait_for_edge(buttonstop, GP.FALLING)
os.system("mpc stop")
except KeyboardInterrupt:
GPIO.cleanup()
os.system("mpc stop")
GPIO.cleanup()
Failure to press a button connected to a port stop button.
source
share