Debounce with millis()
Ignore noise with a short stability window.
Why Not Just delay()?
You could pause with delay() after a press, but that freezes your whole board. The smarter tool for clean buttons is millis().
millis() Is a Stopwatch
millis() returns how many milliseconds your board has been running. You compare two readings to measure elapsed time without stopping.
unsigned long now = millis();All lessons in this course
- Why Buttons 'Bounce'
- Debounce with millis()
- Store a Value in EEPROM
- Remember a Counter After Reset