简体   繁体   中英

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? 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. Then call a restart function in the python script.

Edit, found this article explaining how it can work with a library called GPIO.

https://raspberrypihq.com/use-a-push-button-with-raspberry-pi-gpio/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM