PinLab › Components › Push button
1234 1–3 and 2–4 areinternallyconnected

Push button

tactile switch 6×6 mm

A momentary switch — closes the contact only while pressed. The basic digital input.

Open the course →

How it works

The four legs are two pairs: 1–3 and 2–4 are permanently joined inside. When you press, 1–2 is joined too (i.e. all four). The ESP32 pin must have a defined state when the button is NOT pressed — that is what a pull-up resistor is for. The ESP32 has one built in: pinMode(pin, INPUT_PULLUP). Then the pin reads 1 (HIGH) when released and 0 (LOW) when pressed (the button connects it to GND).

Pins and wiring

PinWhat it isWhere it connects / why
Leg 1 / 3Internally connected pairOne side of the switch → GPIO pin.
Leg 2 / 4Internally connected pairOther side → GND.

Specifications

Size6×6 mm, leg spacing 6.5 × 4.5 mm
Current50 mA max
Life~100 000 presses

Tips and typical mistakes

Used in projects