Pull the input up
10 kΩ to 5 V (or INPUT_PULLUP) makes the pin read HIGH while the button is open.
Build a basic Push Button (Tactile Switch) circuit with labeled pins, component values and connection guidance.
5 V, a 10 kΩ pull-up, the button to ground.
Follow the component values and pin connections
10 kΩ to 5 V (or INPUT_PULLUP) makes the pin read HIGH while the button is open.
Pressed, the button shorts the pin to ground: it reads LOW, and 0.5 mA flows.
Ignore edges for 10–20 ms after the first, or add 100 nF across the button.