Turn LED on (Temporarily) With Button Press

Requires ,

This project creates a momentary LED switch that illuminates only whilst a pushbutton is being pressed.

The circuit works by continuously monitoring the state of a pushbutton connected to digital pin 8. When pressed, the button connects the pin to ground, causing the Arduino to detect a change in state. This state change is then mirrored to digital pin 13, which powers the LED. As soon as the button is released, the LED switches off.

Parts List

  • 1× Arduino Uno
  • 1× Breadboard
  • 1× LED (any colour)
  • 1× 220Ω resistor
  • 1× Momentary pushbutton
  • 1× 10kΩ pull-up resistor
  • Jumper wires

Assembly Instructions

  1. Place the pushbutton across the centre gap of your breadboard
  2. Connect one side of the pushbutton to ground (GND) via the 10kΩ pull-up resistor
  3. Connect the other side of the pushbutton to digital pin 8 on the Arduino
  4. Insert the LED into the breadboard, noting that the longer leg (anode) should connect to pin 13
  5. Connect the LED’s shorter leg (cathode) to a 220Ω resistor
  6. Connect the other end of the 220Ω resistor to ground (GND)