[英]Restart Python Script using a Tactile Switch
is it possible to manually restart a python script using a tactile switch that will be connected to the raspberry pi? 是否可以使用将连接到树莓派的触觉开关手动重启python脚本? I'm currently working on a thesis project that involves using a number recognition script to determine the expiration of a license card.
我目前正在从事一个论文项目,该项目涉及使用数字识别脚本来确定许可证卡的到期时间。 Thank you.
谢谢。
Yes, this would be possible using a Raspberry Pi and would likely require a thread listening for the event from the button to happen. 是的,使用Raspberry Pi可以做到这一点,并且可能需要一个线程来监听按钮中的事件以进行操作。 Then call a restart function in the python script.
然后在python脚本中调用重启函数。
Edit, found this article explaining how it can work with a library called GPIO. 编辑,找到了这篇文章,解释了它如何与称为GPIO的库一起使用。
https://raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/ https://raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.