Arduino multiple button debounce

Опубликовано: 13 Март 2026
на канале: Chris Higgins
6,674
20

Detecting button presses on multiple buttons. Debounce and long/short press detection

Here is the code for the button detection
http://chrishigs.co.uk/arduino/multip...

The variables at the top set the pins for the buttons, number of buttons and the arrays for the required info for each pin, which is then set in buttonSetup() in the Setup() function

Calling buttonHandler[buttonNumber] each time in loop will return an int for the current button state
0=not pressed or returns 0 after long press if button still held down
1=short press
2=long press