TPL-12Templates/Pushbutton 6mm Serial
Pushbutton 6mm Serial
Compact 6mm pushbutton that prints 'Button pressed!' to the Serial Monitor on each press. Uses INPUT_PULLUP — no external resistor needed.
Open in Playgroundbeginner · button · 6mm · serial · digital input · INPUT_PULLUP
FIG. 1Pushbutton 6mm Serial · circuitTPL-12
02Sketch
sketch.inoArduino C++
15 lines
// 6mm Pushbutton — print message on press
const int BTN = 2;
void setup() {
pinMode(BTN, INPUT_PULLUP);
Serial.begin(9600);
Serial.println("Press the button!");
}
void loop() {
if (digitalRead(BTN) == LOW) {
Serial.println("Button pressed!");
delay(200); // simple debounce
}
}03Components
- 01Arduino Uno
- 02Pushbutton 6mm (wokwi-pushbutton-6mm)
04Wiring
| Component pin | Arduino pin |
|---|---|
| Button pin 1.l | Pin 2 |
| Button pin 2.l | GND |
Ready when you are
Have a circuit in mind?
No hardware, no installs — a browser is enough.