gw.sleep and debounce?
-
Hi all,
Forgive me if this is a FAQ... A forum search came up empty
Typically, with pre-mysensors sketches, I would use the debounce library to debounce button presses that cause interrupts. Is that still necessary with gw.sleep? or does it internally debounce the button press when the interrupt is generated before it returns to the caller?
--Steve
-
A software debounce will not work when the Arduino is sleeping. Because it has to measure the input for a limited period of time, in order to determine whether the input is high or low. Since the arduino is sleeping, it will not be able to use the debounce.
if the switch, pir sensor or whatever you use to generate an iterrupt causes an instable reading on the pin which will trigger the interrupt, you could use a debouncing circuit. I have seen them on the internet, but you'll need a schmittrigger for that. I haven't tried that myself yet.
-
thanks @TheoL... Makes sense. In this case, I was wiring up a physical pushbutton for it. I can make a electronic debouncer if I need it, but in my limited testing of this, it didn't seem to need it, so I think I'm good for now. thank you for the reply!
-
A software debounce will not work when the Arduino is sleeping. Because it has to measure the input for a limited period of time, in order to determine whether the input is high or low. Since the arduino is sleeping, it will not be able to use the debounce.
if the switch, pir sensor or whatever you use to generate an iterrupt causes an instable reading on the pin which will trigger the interrupt, you could use a debouncing circuit. I have seen them on the internet, but you'll need a schmittrigger for that. I haven't tried that myself yet.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login