This Arduino project shows how to control an LED using a push button connected in series with the LED and resistor.
The LED turns ON only when the button is pressed because the circuit path is completed.
#define LED 2
void setup() {
pinMode(LED, OUTPUT);
}
void loop() {
digitalWrite(LED, HIGH);
}- Pin 2 is set as OUTPUT
- Pin is driven HIGH continuously
- LED and button are connected in series to GND
- When button is pressed → circuit completes → LED glows
- When button is released → circuit breaks → LED OFF
No input reading is required because the button is used as a hardware switch.
- Arduino board
- LED
- Push button
- 220Ω resistor
- Jumper wires
- Breadboard
Pin 2 → Resistor → LED → Button → GND
Button acts as a series switch.
- Open Arduino IDE
- Select board & port
- Paste code
- Upload
- Press button → LED ON
- Series circuit control
- Using button as hardware switch
- Basic Arduino digital output
✅ Simple hardware-controlled LED project.
Bishnupriya
/image.png)