Controller Digital

Button

A button is a momentary switch: it changes a circuit only while someone is pressing it.

Part images

Button. The momentary switch used for first digital-input projects. Image source: SunFounder Pico 2 W Starter Kit documentation, Components section, © 2026 SunFounder.
Button symbol. SunFounder symbol and internal pairing reference. Image source: SunFounder Pico 2 W Starter Kit documentation, Components section, © 2026 SunFounder.
Pressed button internals. Pressing the cap bridges the two sides of the switch. Image source: SunFounder Pico 2 W Starter Kit documentation, Components section, © 2026 SunFounder.
KY-004 Module Photo. Module Photo for the KY-004 Push Button Switch Module. Image source: Joy-IT SensorKit KY-004 module documentation
KY-004 Pinout / Module Diagram. Pinout / Module Diagram for the KY-004 Push Button Switch Module. Image source: Joy-IT SensorKit KY-004 module documentation
KY-004 Arduino Wiring Diagram. Arduino Wiring Diagram for the KY-004 Push Button Switch Module. Image source: Joy-IT SensorKit KY-004 module documentation
KY-004 Raspberry Pi Wiring Diagram. Raspberry Pi Wiring Diagram for the KY-004 Push Button Switch Module. Image source: Joy-IT SensorKit KY-004 module documentation

What it is

A button is a momentary switch: it changes a circuit only while someone is pressing it.

How students use it

Students use buttons for start/stop controls, input choices, games, counters, alarms, and quick tests that prove the Pico can read a real-world input.

Pins and power

Four legs in two connected pairs. SunFounder notes pins 1 and 2 are connected together, and pins 3 and 4 are connected together.

Passive switch. Wire it as a 3.3V-safe digital input with a pull-up or pull-down path.

Pressing the button connects the two sides together. Use one leg from each internal pair; using two legs from the same side will not create a useful input.

Voltage and safety

Keep button circuits tied to 3.3V and GND, not 5V. A floating input will read randomly without a pull-up or pull-down.

Power off before moving the button on the breadboard. Check that the button straddles the center gap when the lesson expects that layout.

Module internals

Spring contact, four through-hole legs, plastic cap, and a small internal metal contact that bridges the two sides when pressed.

Datasheet notes

SunFounder identifies the kit part as a 6 mm mini push-button but does not publish a manufacturer part number. For exact ratings, match the physical button and markings to a tactile-switch datasheet.

Common libraries

No special library is needed. Use machine.Pin with an internal or external pull resistor.

Common mistakes

Rotating the button 90 degrees, wiring both signal wires to the same internal side, forgetting the pull resistor, and treating bouncing contacts as multiple intentional presses.