Apr-01-2018, 12:14 PM
Unfortunately I'm lost. I don't understand why it does not run as expected. To understand what I was trying read this
https://sourceforge.net/p/raspberry-gpio...ki/Inputs/
I posted it before. It describes the two different approaches to detecting change in pin - pooling and edge_detection. edge_detection has tow possible implementations - one is wait_for_edge and one is event_detect. event_detect on its turn has two possible implementations - one I try to use here and one with callback function which will run in separate thread.
The benefit of using event_detect is that it (supposedly) execute the code only once. In your original code you use pooling - it is running non-stop and sending commands to respective pin. e.g. stop motor even if it is already stopped. that is why it sends multiple sms. I was trying to use event detection, so stop motor for example is executed only once and thus allowing to send single sms at that moment.
The other link I posted yesterday from RPi forum is useful to explain multiple edge detections, but it looks a bit old and in RPio.GPIO package has this bouncetime property that is used to prevent event detection for some ms after first event.
https://sourceforge.net/p/raspberry-gpio...ki/Inputs/
I posted it before. It describes the two different approaches to detecting change in pin - pooling and edge_detection. edge_detection has tow possible implementations - one is wait_for_edge and one is event_detect. event_detect on its turn has two possible implementations - one I try to use here and one with callback function which will run in separate thread.
The benefit of using event_detect is that it (supposedly) execute the code only once. In your original code you use pooling - it is running non-stop and sending commands to respective pin. e.g. stop motor even if it is already stopped. that is why it sends multiple sms. I was trying to use event detection, so stop motor for example is executed only once and thus allowing to send single sms at that moment.
The other link I posted yesterday from RPi forum is useful to explain multiple edge detections, but it looks a bit old and in RPio.GPIO package has this bouncetime property that is used to prevent event detection for some ms after first event.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs