Skip to content

Debounce Switch, Rev 1.0

Latest
Compare
Choose a tag to compare
@bdubs-astro bdubs-astro released this 09 May 17:44

A c++ class for de-bouncing a mechanical switch.

  • The required parameters are:

    • the GPIO input pin #
    • a flag that's true if using an internal pullup resistor, or false otherwise
    • a pair of callback functions that get called when the input pin goes either low or high
    • a debounce delay in milliseconds
  • The initPin() member function must be called first. It configures the input pin, and returns the inital state of
    the switch.

  • The readPin(debounceDelay) member function returns the current state (de-bounced), and calls
    the appropriate callback function whenever the pin's state changes.

Full Changelog: https://github.com/bdubs-astro/DebounceSwitch/commits/v1.0