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)
