Stop PWM thread immediately when stop() is called
A Python module to control the GPIO on a Raspberry Pi
Brought to you by:
croston
The PWM thread stops only when the full body of the loop ends. After that, the GPIO port is set to low. Imagine that you have started a PWM which runs with a one minute frequency (blinking once in a minute). Then you stop it and start a new PWM with a 1 sec frequency. This second thread stats nicely but when the first thread exists (a few seconds later) it resets the GPIO port to low and masses up all previous setups. The best solution would be to "kill" the thread immediately, wait for its termination or do not set the GPIO port after exiting the loop. What do you think?