ARDUINO UNO - Commom Cathode RGB LED 3-colour Blink Using Simple Code

2,579

16

2

Here is a simple circuit with even simpler code to blink a common cathode RGB LED. All you need is basic information about Arduino UNO and understanding of simple Arduino Code such as 'Blink' example code in Arduino IDE.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Components Needed

You will need following components:

1. Arduino UNO (or any ARduino UNO clone board)

2. 3 X 220 Ohm Resistor

3. Common Cathode RGB LED

4. Bread board

5. Jumper Cables

Step 2: Circuit Connection

Now connect the Common Cathode of the RGB LED to any Ground Pin on the Arduino UNO.

Connect the 3 anode legs to 220 Ohm resistor and further connect them to digital pin 6, 4 and 3.

The circuit is done now head over to the Arduino IDE

Step 3: The Code

void setup() {

// initialize digital pin 3,4 & 6 as an output.

pinMode(3, OUTPUT);

pinMode(4, OUTPUT);

pinMode(6, OUTPUT); }

// the loop function runs over and over again forever

void loop() {

//here current flows through pin 6 illuminating red led in the RGB LED

digitalWrite(3, LOW);

digitalWrite(4, LOW);

digitalWrite(6, HIGH);

delay(500);

//here current flows through pin 3 illuminating green led in the RGB LED

digitalWrite(3, HIGH);

digitalWrite(4, LOW);

digitalWrite(6, LOW);

delay(500);

//here current flows through pin 4 illuminating blue led in the RGB LED

digitalWrite(3, LOW);

digitalWrite(4, HIGH);

digitalWrite(6, LOW);

delay(500);

//Further mixture of colours can be crteated by keeping any two pins HIGH at the same time

}

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    2 Discussions