- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我被 Python 包中的 wait_for_edge 函数卡住了 RPi .我为下降的 gpio 添加了多个事件检测,只要回调函数不包含像
os.system("mpc pause")
然后脚本崩溃并显示错误消息:“RunetimeError: Error #5 waiting for edge”有谁知道这个错误消息想说什么?或者我在哪里可以找到这样的东西?
具体来说,这段代码有效:
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()
但是这段代码没有:
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()
按下连接到端口 buttonstop 的按钮后崩溃。
最佳答案
super hacky,但是在 os.system 调用之后,如果您取消绑定(bind)事件然后立即重新绑定(bind)它,它似乎可以工作。
def next(channel):
print "In next"
os.system("mpc next")
GPIO.remove_event_detect(buttonnext)
GPIO.add_event_detect(buttonnext,GP.FALLING,callback=next,bouncetime=200)
关于python - 带有威胁回调的树莓派 RPi.GPIO 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22000515/
过去我们多次收到有关 Java 威胁的警告,我们不得不升级,有时甚至摆脱 Java。 现在我正在考虑为 Android 设备开发,我发现它与 Java 密切相关。 我的问题:Java 威胁对 Andr
当我尝试访问应用程序的某些部分时,我的应用程序显示此错误。此外,当我尝试在 iPhone 6s 模拟器上运行它时,它不会显示此错误,但在所有其他模拟器上都会显示该错误 我使用 Firebase 作为后
来自 OAuth 2.0 Threat Model and Security Considerations draft : 4.4.1.13. Threat: Code substitution (O
我试图证明在 PHP 中准备语句的必要性,但我遇到了一点问题,因为 PHP 使用通过表单传递的字符串做了一些很奇怪的事情。 我试图“打破”的陈述很简单: SELECT username FROM us
我确实计划将数据库从 5.1 版迁移到 5.6 版。我想通过使用 mysqldump 来做到这一点: 将数据从 MySQL DB 5.1 导出(通过 mysqldump)到 sql 文件, 导入(通过
我有目的地(为了测试)在 WebMatrix C# 中分配了以下变量: string val = "alert('XSS Vector')"; 在页面的后面,我使用 razor 将该值直接写入页面。
为了拥有一个 URL 友好的应用程序,我正在存储它的上下文在 URL 中有一个 JSON,它给出类似的东西: http://mysite.dev/myapppage/target#?context={
用户正在向我们的 React 应用程序提供一个字符串,并且它正在显示给其他用户。我想搜索一些字符,并用一些 HTML 替换它们,就像我要搜索“特殊”这个词一样,我会将其变成: My special w
我是一名优秀的程序员,十分优秀!