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


  • Contest Winner

    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!


  • Hero Member

    @TheoL a simple capacitor to ground is sufficient in most cases. If you use the Arduino internal pull-up a you only need a capacitor of around 300 nF to 1 uF.( the "100" value in the schematic) upload-53d39f96-249f-4900-b3b0-8cf81b7e09cc


Log in to reply
 

Suggested Topics

  • 1
  • 2
  • 2
  • 10
  • 1
  • 5

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts