I'm getting stuck with the wait_for_edge function in the Python package RPi. I added multiple event detections for falling gpio's and everything works fine as long as the callback functions contain not a comand like
os.system("mpc pause")
Then the script crashes with the error message: "RunetimeError: Error #5 waiting for edge" Does anybody know, what this error message wants to say? Or where I can look up things like this?
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 doesnt:
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()
It crashes after pushing the button connected to the port buttonstop.