🔰 Project: Multiple Button LED Control using Arduino Nano
💡 Project Overview
In this project, you’ll use three push buttons to independently control three LEDs connected to your Arduino Nano.
Each button controls one LED — for example:
- Button 1 turns ON/OFF the Red LED
- Button 2 turns ON/OFF the Yellow LED
- Button 3 turns ON/OFF the Green LED
This is a perfect beginner project to learn digital input–output control and button debouncing in Arduino.
⚙️ Components Required
| Component | Quantity | Description |
|---|---|---|
| Arduino Nano | 1 | Main microcontroller |
| LEDs (Red, Yellow, Green) | 3 | Output indicators |
| Push Buttons | 3 | Input switches for controlling LEDs |
| 220Ω Resistors | 3 | For LEDs |
| 10kΩ Resistors | 3 | Pull-down resistors (if not using INPUT_PULLUP) |
| Breadboard | 1 | For connections |
| Jumper Wires | Several | For wiring |
🧩 Circuit Connection (Text Description)
You can reuse the same LED wiring:
| LED Color | Arduino Nano Pin | Connection Details |
|---|---|---|
| LED 1 (Red) | A3 | Anode (+) → A3 via 220Ω resistor, Cathode (–) → GND |
| LED 2 (Yellow) | A4 | Anode (+) → A4 via 220Ω resistor, Cathode (–) → GND |
| LED 3 (Green) | A5 | Anode (+) → A5 via 220Ω resistor, Cathode (–) → GND |
🖲️ Button Connections
We’ll use digital pins D2, D3, and D4 for the three buttons.
| Button | Arduino Pin | Connection Details |
|---|---|---|
| Button 1 | D2 | One leg → D2, other leg → GND |
| Button 2 | D3 | One leg → D3, other leg → GND |
| Button 3 | D4 | One leg → D4, other leg → GND |
Each button pin uses Arduino’s internal pull-up resistor, so no external 10kΩ resistor is needed.
🪛 Wiring Summary
A3 → 220Ω → LED1 → GND
A4 → 220Ω → LED2 → GND
A5 → 220Ω → LED3 → GND
D2 → Button 1 → GND
D3 → Button 2 → GND
D4 → Button 3 → GND
✅ LEDs: OUTPUT
✅ Buttons: INPUT_PULLUP
💻 Arduino Code – Multiple Button LED Control
// Multiple Button LED Control using Arduino Nano
// LEDs on A3, A4, A5; Buttons on D2, D3, D4
#define LED1 A3
#define LED2 A4
#define LED3 A5
#define BTN1 2
#define BTN2 3
#define BTN3 4
void setup() {
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(BTN1, INPUT_PULLUP);
pinMode(BTN2, INPUT_PULLUP);
pinMode(BTN3, INPUT_PULLUP);
}
void loop() {
// Buttons are active LOW (pressed = LOW)
if (digitalRead(BTN1) == LOW) {
digitalWrite(LED1, HIGH);
} else {
digitalWrite(LED1, LOW);
}
if (digitalRead(BTN2) == LOW) {
digitalWrite(LED2, HIGH);
} else {
digitalWrite(LED2, LOW);
}
if (digitalRead(BTN3) == LOW) {
digitalWrite(LED3, HIGH);
} else {
digitalWrite(LED3, LOW);
}
}
🧠 Code Explanation
- Pin Setup:
- LEDs are connected to A3, A4, A5 (outputs).
- Buttons are connected to D2, D3, D4 (inputs with internal pull-up).
- INPUT_PULLUP Logic:
- Each button reads
HIGHwhen not pressed. - When pressed, it connects to GND → reads
LOW.
- Each button reads
- Loop Section:
- Each LED turns ON when its button is pressed.
- When the button is released, the LED turns OFF.
- No delay() Used:
- The program continuously checks all button states, so it’s very responsive.
🔄 Output Behavior
- Press Button 1 → LED1 (A3) turns ON
- Press Button 2 → LED2 (A4) turns ON
- Press Button 3 → LED3 (A5) turns ON
- Releasing any button turns OFF its LED
💬 Project Summary
This project demonstrates:
- Multiple input handling
- Independent LED control
- Use of internal pull-up resistors
Pingback: Arduino Demo Kit Projects - Motion Demo Kit (With Arduino) - Project List - EDGENext Learning