Introduction: Easy RGB LED

Picture of Easy RGB LED

Easy Red, Green, Blue LED arduino for beginners. I will include some different codes and what each means.

Needed
-RGB LED
-Arduino Uno
-Jumper Wires
-9v batt. and cord

Step 1:

Picture of

Step 2: RGB Pins

Picture of RGB Pins

Connect v pin to yellow wire, green wire to g pin, blue wire to b pin, and red wire to r pin. The color doesn't matter as long as you assign that color of wire to Red, Green, Blue, or ground.

Step 3: Arduino Pins

Picture of Arduino Pins

Connect the yellow wire to ground, then green wire to pin 13, blue to pin 12, and red to pin 11

Step 4: Code

Picture of Code

The code I have on it right now is just a simple blink sketch. It first turns flashes green for the setup, then in the loop flashes red and blue with a 200 delay. I will add more codes as I am able to make them.

Code:Blink

int green = 13; //declare/initialize led colors to their pins
int red = 12;

int blue = 11;

void setup() {

//initialize pins

pinMode(13, OUTPUT);

pinMode(12, OUTPUT);

pinMode(11, OUTPUT);

}

// the loop function runs over and over again forever

void loop() {

digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)

delay(200); // wait for a second

digitalWrite(13, LOW); // turn the LED off by making the voltage LOW

delay(200); // wait for a second

digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)

delay(200); // wait for a second

digitalWrite(12, LOW); // turn the LED off by making the voltage LOW

delay(200); // wait for a second

digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level)

delay(200); // wait for a second

digitalWrite(11, LOW); // turn the LED off by making the voltage LOW

delay(200); // wait for a second }

Code:Blink Without Delay

int green = 13; //declare/initialize led colors to their pins
int red = 12;

int blue = 11;

void setup() {

//initialize pins

pinMode(13, OUTPUT);

pinMode(12, OUTPUT);

pinMode(11, OUTPUT);

}

// the loop function runs over and over again forever

void loop() {

digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)

delay(1000);

digitalWrite(13, LOW); // turn the LED off by making the voltage LOW

digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)

delay(100); // wait for a second

digitalWrite(12, LOW); // turn the LED off by making the voltage LOW

digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level)

delay(200); // wait for a second

digitalWrite(11, LOW); // turn the LED off by making the voltage LOW

digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)

delay(1000); // wait for a second

digitalWrite(13, LOW); // turn the LED off by making the voltage LOW

digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)

delay(10); // wait for a second

digitalWrite(12, LOW); // turn the LED off by making the voltage LOW

digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level)

delay(200); // wait for a second

digitalWrite(11, LOW); // turn the LED off by making the voltage LOW

digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)

delay(50); // wait for a second

digitalWrite(13, LOW); // turn the LED off by making the voltage LOW

digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)

delay(100); // wait for a second

digitalWrite(12, LOW); // turn the LED off by making the voltage LOW

digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level)

delay(20); // wait for a second

digitalWrite(11, LOW); // turn the LED off by making the voltage LOW

digitalWrite(13, HIGH);

delay(1000);

digitalWrite(13, LOW);

digitalWrite(12, HIGH);

delay(1000);

digitalWrite(12, LOW);

digitalWrite(11, HIGH);

delay(2000);

digitalWrite(11, LOW);

digitalWrite(13, HIGH);

delay(1000);

digitalWrite(13, LOW);

digitalWrite(12, HIGH);

delay(1000);

digitalWrite(12, LOW);

digitalWrite(11, HIGH);

delay(2000);

digitalWrite(11, LOW); }

Comments

Jaxton Maez (author)2015-01-19

You can change the order or timing by copying and pasting or changing the delay times.

Jaxton Maez (author)2015-01-19

int green = 13; //declare/initialize led colors to their pins

int red = 12;

int blue = 11;

void setup() {

//initialize pins

pinMode(13, OUTPUT);

pinMode(12, OUTPUT);

pinMode(11, OUTPUT);

}

// the loop function runs over and over again forever

void loop() {

digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)

delay(1000); // wait for a second

digitalWrite(13, LOW); // turn the LED off by making the voltage LOW

delay(1000); // wait for a second

digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)

delay(1000); // wait for a second

digitalWrite(12, LOW); // turn the LED off by making the voltage LOW

delay(1000); // wait for a second

digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level)

delay(1000); // wait for a second

digitalWrite(11, LOW); // turn the LED off by making the voltage LOW

delay(1000); // wait for a second

}

djsadeepa (author)2015-01-10

void setup() {

// initialize digital pin 13 as an output.

pinMode(13, OUTPUT);

}

// the loop function runs over and over again forever

void loop() {

digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)

delay(1000); // wait for a second

digitalWrite(13, LOW); // turn the LED off by making the voltage LOW

delay(1000); // wait for a second

}

Jaxton Maez (author)2015-01-09

I cant upload a sketch or video right now, but will as soon as I can.

About This Instructable

769views

16favorites

License:

More by Jaxton Maez:Arduino flashing LED lampEasy RGB LEDMini Pencil
Add instructable to: