我一直在使用Python包中的wait_for_edge函数 RPi。 我为下降的gpio添加了多个事件检测,只要回调函数不包含comand-like,一切正常
os.system("mpc pause")
然后脚本崩溃并显示错误消息:“RunetimeError:error#5 waiting for edge” 有人知道这个错误信息想说什么吗?或者我可以在哪里查到这样的东西?在
具体地说,这一准则起作用:
^{pr2}$但这段代码并没有:
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()
它在按下连接到端口按钮stop的按钮后崩溃。在
超级骇客,但就在操作系统打电话,如果你取消绑定事件,然后马上重新绑定,它似乎有效。在
相关问题 更多 >
编程相关推荐