Reputation: 41
My Python 2.7 script (on Raspberry Pi Debian) runs a couple of stepper motors synchronously via the GPIO port. I currently have a signal handler in place for Ctrl-C to clean up tidily before exit. I'd now like to extend that method such that keyboard inputs could also generate SIGUSR1 or similar as an asynchonous control mechanism. I know this could be achieve through threading, but I'm after a KISS approach.
Ta
Upvotes: 4
Views: 513
Reputation: 2335
Have a parent process that monitors keyboard input, and forward a signal to the child if it occurs.
Upvotes: 1