Documentation

Project1 - Dual Button Color Control System

Updated August 19, 2026

1. What You Will Build

In this tutorial, you will learn how to build Project1 - Dual Button Color Control System using Arduino Starter Shield Kit.

By the end of this tutorial, your project will be able to:

  • • Control LED 1 using Switch 1

    • Control LED 2 using Switch 2

    • Change RGB LED color automatically when both switches are pressed

2. What You Will Learn

After completing this tutorial, you should understand:

  • How RGB LED color mixing works

  • How to control multiple LEDs using digital outputs

  • How the code works step by step

3. Components Needed

No.

Component

Quantity

1

Arduino

1

2

Arduino Starter Shield Kit

1

4. Software Needed

Use the tools below depending on your board.

Board

Software

Arduino

Arduino IDE 

Libraries Needed

No library needed

5. Circuit Connection

Connect the components as shown below.

Wiring Steps

  1. Connect Arduino shield kit to the Arduino Uno board

6. Code

#define SW1 2
#define SW2 3

#define LED1 13
#define LED2 12

#define RED   9
#define GREEN 10
#define BLUE  11

void setup() {
  pinMode(SW1, INPUT_PULLUP);
  pinMode(SW2, INPUT_PULLUP);

  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);

  pinMode(RED, OUTPUT);
  pinMode(GREEN, OUTPUT);
  pinMode(BLUE, OUTPUT);
}

void loop() {
  bool sw1 = !digitalRead(SW1);
  bool sw2 = !digitalRead(SW2);

  // Control normal LEDs
  digitalWrite(LED1, sw1);
  digitalWrite(LED2, sw2);

  // If both switches are pressed
  if (sw1 && sw2) {

    setColor(1,0,0); // Red
    delay(500);

    setColor(0,1,0); // Green
    delay(500);

    setColor(0,0,1); // Blue
    delay(500);

    setColor(1,1,0); // Yellow
    delay(500);

    setColor(1,0,1); // Purple
    delay(500);

    setColor(0,1,1); // Cyan
    delay(500);

    setColor(1,1,1); // White
    delay(500);
  }
  else {
    // RGB OFF
    setColor(0,0,0);
  }
}

void setColor(bool r, bool g, bool b) {
  digitalWrite(RED, r);
  digitalWrite(GREEN, g);
  digitalWrite(BLUE, b);
}

7. Upload / Run the Project

  1. Connect the board to your computer using USB.

  2. Open the code in Arduino IDE.

  3. Select the correct board.

  4. Select the correct port.

  5. Click Upload.

  6. Open the Serial Monitor if needed.

8. Expected Result

When the project is working correctly:

  • Press Switch 1 → LED 1 turns ON.

  • Press Switch 2 → LED 2 turns ON.

  • Press both Switch 1 and Switch 2 → RGB LED changes colors automatically.

9. Troubleshooting

Problem

Possible Fix

Board not detected

Check USB cable, driver, board, and port selection

Code upload failed

Select the correct board and COM port

Technical Article
By ZiraaSTEM