RTC sleep and interrupt callback clarification
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: RTC sleep and interrupt callback clarification
Fair point.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: RTC sleep and interrupt callback clarification
Here's another good article I found on switch bounce including some simple external circuitry you can use to tame it:
http://www.allaboutcircuits.com/technic ... l-with-it/
http://www.allaboutcircuits.com/technic ... l-with-it/
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: RTC sleep and interrupt callback clarification
It's trivial in code if you're running a cooperative scheduler. If the pin state differs from the debounced output state, wait for a period and check again. If they still differ, change the debounced output state and optionally execute a callback. The key point being that during the wait, the processor gets on with other tasks. (I appreciate this is familiar territory to you, Dave
)
e.g. https://github.com/peterhinch/Micropyth ... /switch.py

e.g. https://github.com/peterhinch/Micropyth ... /switch.py
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.