Skip to content

Instantly share code, notes, and snippets.

@erikpena
erikpena / main.ino
Last active July 21, 2023 05:27
A simple hardware button debouncer using ESP8266 libraries within the Arduino IDE.
// pin is 2.
const int multiButton = 2;
void setup() {
// Configure the pin mode as an input.
pinMode(multiButton, INPUT);
// Attach an interrupt to the pin, assign the onChange function as a handler and trigger on changes (LOW or HIGH).
attachInterrupt(multiButton, onChange, CHANGE);