RGB LED

SRJT09104

Jugaadu is given a task to arrange an inter-college dancing competition and other events in his college. For the preparation of the stage, he is thinking of putting a colour lighting effect that will turn on different colour lights periodically. Can you help him to complete this task ?

  1. Arduino UNO
  2. Arduino UNO Cable (A to B)
  3. RGB LED
  4. Jumper Wires
We can perform by simply glowing an RGB LED with the help of Arduino UNO. We can set turn ON period of all the three colours periodically in the code like 1sec Red, 1sec Blue, 1Sec green and 1Sec blank.

    int RED_PIN = 11;
int GREEN_PIN = 10;
int BLUE_PIN = 9;

void setup()
{
Serial.begin(9600);
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
}

void loop()
{
digitalWrite(RED_PIN, HIGH);
digitalWrite(GREEN_PIN, LOW);
digitalWrite(BLUE_PIN, LOW);
delay(2000);

digitalWrite(RED_PIN, LOW);
digitalWrite(GREEN_PIN, HIGH);
digitalWrite(BLUE_PIN, LOW);
delay(2000);

digitalWrite(RED_PIN, LOW);
digitalWrite(GREEN_PIN, LOW);
digitalWrite(BLUE_PIN, HIGH);
delay(2000);