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
- Place the pushbutton across the centre gap of your breadboard
- Connect one side of the pushbutton to ground (GND) via the 10kΩ pull-up resistor
- Connect the other side of the pushbutton to digital pin 8 on the Arduino
- Insert the LED into the breadboard, noting that the longer leg (anode) should connect to pin 13
- Connect the LED’s shorter leg (cathode) to a 220Ω resistor
- Connect the other end of the 220Ω resistor to ground (GND)