Skip to content

bdubs-astro/DebounceSwitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

DebounceSwitch

A c class for de-bouncing a mechanical switch.

The parameters are the GPIO pin #, a flag that's true if using an internal pullup resistor, a pair of callback functions that get called when the pin goes either high or low, and a debounce delay in ms.

The initPin() command must be called first. It configures the input pin, and returns the inital state of the switch.

The readPin(int debounceDelay) command returns the current state (de-bounced), and calls the corresponding callback function whenever the state changes.

image

ESP8266 D1 Mini

image Source: https://www.mischianti.org/2021/04/26/wemos-d1-mini-high-resolution-pinout-and-specs/

image

Source: https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/

ESP32 Dev Kit

image

Source: https://forum.fritzing.org/t/esp32s-hiletgo-dev-boad-with-pinout-template/5357