Project 2.5.7:LED Control with Arduino and Push Button
| Description | In this project, you will learn how to use a push button to control four LEDs with an Arduino Uno. The push button acts as an input switch that sends a signal to the Arduino, which then controls the four LEDs by turning them on or off based on programmed instructions. This helps to demonstrate how a single input device can manage multiple outputs in a simple electronic control system, improving understanding of digital input and output operations. | | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Use case | This project can be used in simple control and indicator systems where multiple status signals are required. For example, the push button can be used to cycle through four LED states such as system modes, progress indicators, or warning levels (low, medium, high, and critical). It can also be applied in automation systems, control panels, and educational models where users need visual feedback from multiple outputs based on a single input.|
Components (Things You will need)
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|---|---|
Building the circuit
Things Needed:
- Arduino Uno = 1
- Arduino USB cable = 1
- Resistor = 1
- Push button = 1
- Red LED = 1
- Yellow LED = 1
- Green LED = 1
- Blue jumper wire= 1
- Yellow jumper wire= 1
- Black jumper wire= 1
- Red jumper wire= 1
Mounting the component on the breadboard
Step 1.0: The push button has four unassigned pins.
Step 1.1: On the middle section of the breadboard, locate each horizontal section lettered A to J.
Step 1.2: Take the push button and insert two pins into the lettered section ‘g’ horizontally.
Step 1.3: Insert the other two pins into the lettered section ‘d’ horizontally.
.
step 2.0: Take the Yellow LED and insert it into any of the lettered section (Say A) horizontally. step 2.1: Take the Green LED and insert it into any of the lettered section (Say A) horizontally. step 2.2: Take the Blue LED and insert it into any of the lettered section (Say A) horizontally
.
WIRING THE CIRCUIT
Things Needed:
- Red male-male-to-male jumper wires = 2
- White male-to-male jumper wires = 5
- Green male-to-male jumper wires = 1
- Yellow male-to-male jumper wires = 1
- Black male-to-male jumper wires = 1
- Blue male-to-male jumper wires = 2
step 1: Take the Red male-male-to-male jumper wire and place one side of the wire pin under the push button pin located on the lettered section ‘d’ and the other side of the wire pin to the digital pin 2 on the Arduino uno board.
.
step 2: Take the Black male-male-to-male jumper wire and place one side of the wire pin under the other push button pin located on the lettered section ‘d’ and the other side of the wire pin to GND on the Arduino uno board.
.
step 3: Take the Red male-male-to-male jumper wire and place one side of the wire pin under the Positive pin of the Red LED and the other side of the wire pin to the digital pin 3 on the Arduino uno board.
.
step 4: Take the White male-male-to-male jumper wire and place one side of the wire pin on the Negative horizontal section on the breadboard and the other side of the wire pin to GND on the Arduino uno board. This allows for the negative section to be used as a substitute for GND when mounting multiple components.
.
step 5: Take the White male-male-to-male jumper wire and place one side of the wire pin under the Negative pin of the Red LED and the other side of the wire pin to the Negative horizontal section on the breadboard.
.
step 6: Take the Yellow male-male-to-male jumper wire and place one side of the wire pin under the Positive pin of the Yellow LED and the other side of the wire pin to the digital pin 4 on the Arduino uno board.
.
PROGRAMMING
Step 1: Open your Arduino IDE. See how to set up here: Getting Started.
Step 2: Type the following codes before the void setup function.
const int buttonPin= 2;
int red = 3;
int yellow = 4;
int green = 5;
int blue = 6;
int buttonState= 0;
.
Step 3: After the void setup ()within the curly brackets type the following codes.
pinMode (buttonPin, INTPUT_PULLUP);
pinMode (red, OUTPUT);
pinMode (yellow, OUTPUT);
pinMode (green, OUTPUT);
pinMode (blue, OUTPUT);
.
Step 4: : After the (void loop ()) within the curly brackets type
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
digitalWrite (red, HIGH);
delay (500);
digitalWrite (red, LOW);
delay (500);
digitalWrite (yellow, HIGH);
delay (500);
digitalWrite (yellow, LOW);
delay (500);
digitalWrite (green, HIGH);
delay (500);
digitalWrite (green, LOW);
delay (500);
digitalWrite (blue, HIGH);
delay (500);
digitalWrite (blue, LOW);
delay (500);
}
.
Uploading the code
Step 1: Save your code. See the Getting Started section
Step 2: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.
Step 3: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code
CONCLUSION
If you encounter any problems when trying to upload your code to the board, run through your code again to check for any errors or missing lines of code. If you did not encounter any problems and the program ran as expected, Congratulations on a job well done.





