Button-Controlled LED
Use a pushbutton as a digital input to control an LED. Learn about digital input, pull-down resistors, and conditional logic.
What students learn
Students learn how to read digital inputs using digitalRead(), understand pull-down resistors, and use if/else conditional statements.
The science behind this experiment
- digitalRead() returns HIGH (1) or LOW (0) based on pin voltage
- A pull-down resistor ensures the pin reads LOW when the button is not pressed
- Without a pull-down resistor, the pin "floats" and gives random readings
- if/else statements allow code to make decisions based on input
Key relation: Pull-down: when button open, V_pin = 0V (LOW); when button pressed, V_pin = 5V (HIGH)
Equipment used
- Arduino Uno R3
- Breadboard
- 1x Pushbutton
- 1x Red LED
- 1x 220Ω resistor
- 1x 10kΩ pull-down resistor
- Jumper wires
Questions for students
- What is button "debouncing" and why might you need it?
- How would you make the LED toggle (stay on after one press, off after the next)?
What to expect
The LED lights up when the button is pressed and turns off when released. Digital input with digitalRead() allows Arduino to respond to physical interactions. Pull-down resistors ensure reliable readings, and if/else logic enables decision-making in code.
Run this experiment in your classroom
This experiment is part of ATP Volta — a self-contained mobile science lab that turns an ordinary classroom into a working STEM laboratory, with over 200 experiments in physics, chemistry, biology, robotics and engineering. Gali, the AI tutor built into ATP Connect, guides students through each step and answers their questions at the bench.
See the ATP Volta mobile science labTalk to our team