Home - PaulMurrayCbr/DebounceInput GitHub Wiki

DebounceInput is a library for the Arduino IDE for debouncing digital inputs (buttons, switches).

DebounceInput uses a simulated RC network and schmitt trigger. The trigger bounds are settable, allowing you to adjust the sensitivity. Methods are provided to rate-limit samples so as to provide consistent behaviour.

See Usage for a quick-start. See Algorithm for a description of how it works. See Installation for how to download and install it.

Features:

  • Small. The DebouncedButton class has a sizeof 6. The underlying filter class has a sizeof 5.

  • Fast. The class does not use delay() to sample the input. The algorithm itself uses bit-fiddling and integer math to implement the filter algorithm - no floating point arithmetic.

  • Easy to use for the usual case. Detecting a 'button down' event is a one-liner. See Usage.

  • Works pretty well. cactusjack's algorithm simulates a RC low-pass filter and trigger. Further refinements are discussed in Algorithm.