
The Button Controlled LED project introduces one of the most fundamental design concepts in embedded systems: Digital Inputs. In this guide, a physical tactile push button connected to Pin 2 is monitored to control an LED linked to Pin 13 dynamically.
When the tactile button is pressed, the Arduino detects a voltage transition state and turns the LED ON. Releasing the button breaks the channel, automatically turning the LED OFF.
This lesson explores several key hardware and programming architectures:
To build this circuit, collect these specific items from your kit:
Arduino Uno MCU Board × 1Breadboard × 1LED × 1Push Button Switch × 1220Ω Current-Limiting Resistor × 1Jumper Wires × 4USB Cable × 1GND pin directly onto the long blue negative rail (-) of your breadboard. This sets up a unified reference voltage plane for the loop.Anode (+) to Arduino digital Pin 13 through your 220Ω protective resistor.Cathode (-) directly over to the negative ground rail line.Pin 2.Push Button Warning: Always position the push button across the center split trench of the breadboard. Incorrect placement on a single horizontal row can bridge both terminals together permanently, shorting the circuit path and preventing the microcontroller from reading changes.
Pin 13 and Pin 2 cleanly, and ensure all ground connections return to the breadboard's common negative rail layer.Inside your initialization function setup(), the Arduino sets up the I/O configurations:
Pin 13 is set as an OUTPUT to drive current out to the LED.Pin 2 is set using INPUT_PULLUP mode.The built-in internal pull-up resistor pulls the voltage level on Pin 2 up to a default stable HIGH (+5V) state when the button is open, completely removing the need for an external resistor.
Inside your continuous runtime loop loop(), the Arduino tracks the button status via digitalRead(2):
GND. Pin 2 collapses to a LOW logic state (0V), instructing the Arduino to turn the LED on.HIGH state (+5V), instructing the Arduino to turn the LED off.The program simultaneously streams telemetry back to the computer console using Serial.println(). When the button is closed and reading a ground connection, it outputs a 1 to indicate an active trigger state. When released, it outputs a 0.
After successfully compiling and flashing your sketch to the board:
LED.LED off.9600 baud rate will display a real-time stream of 1 tags when pressed and 0 tags when released.LED Does Not Turn ON: If the button click path fails to trigger the light source, verify your output wiring lines. Check the LED polarity layout orientation, check that your current resistor is seated cleanly on the correct lines, and ensure your signal wire runs to Pin 13.
Push Button Not Responding: If your input clicks register no changes, check your button orientation. Ensure the switch bridges the center gap cleanly and confirm that one side routes down to a GND node while the other terminates at Pin 2.
Serial Monitor Shows No Values: If your terminal screen remains blank, check your initialization blocks. Confirm that your code executes Serial.begin(9600); inside setup(), and verify that the bottom-right dropdown value inside your IDE Serial Monitor window matches 9600 baud.
LED Remains ON Continuously: If your LED light source is activated immediately before you touch the button, this indicates an unexpected circuit bridge or missing software rules. Double-check that you configured INPUT_PULLUP correctly in your setup block rather than standard INPUT.
By completing your second micro-processing laboratory project, you have mastered:
INPUT_PULLUP simplifies hardware schematics by activating internal chip components.In Day 3, you will learn how to turn a basic momentary push button into a true toggle switch! We will look at how to store previous states inside software memory variables, where a single click leaves the LED fully on and a subsequent click turns it off.