Push Button (Momentary Switch)
A tactile switch that connects only while you hold it down.
How it works
A momentary push button (tactile switch) makes an electrical connection only while pressed, and springs back open when released — unlike a latching switch that stays put.
The common 4-pin tactile button is really two pairs of legs: the two legs on each side are permanently joined inside, and pressing the button bridges the two sides together. If a button seems 'always on', you're using two legs that are already connected — use legs on opposite corners.
Read a button with a digital input. The easiest approach is the microcontroller's built-in pull-up (INPUT_PULLUP): the pin sits HIGH and reads LOW when the button connects it to ground — no external resistor needed.
Pins
- Leg A
- One side of the switch — to a digital input pin.
- Leg B
- Opposite-corner leg — to GND (with INPUT_PULLUP).
Ratings
- Type
- Momentary, normally-open
- Pinout
- 4 legs = 2 pairs; use opposite corners
Tips
- Use pinMode(pin, INPUT_PULLUP) to skip the external resistor; pressed reads LOW.
- If it reads as always pressed, switch to diagonally-opposite legs.
- Add a short debounce delay or check twice for clean presses.