RGB Led with Arduino :

In this lecture we will learn how to interface with RGB led. And how to make amazing colors using RGB led. AS we know that Red, Green and blue are the basic primary colors and we can make any color by mixing those colors. So in this project we will mix the colors and make some amazing colors. We use Arduino analog write function to obtain different functions.

RGB

Components :

  • Arduino Uno
  • Jumper Wires
  • Breas Board
  • RGB Led

RGB pinout :

  • GND –> GND
  • R –> D9
  • G –> D10
  • B –> D11
Pinout

Circuit Diagram :

Code :



int R = 9;  
int G = 10;
int B = 11; 

// the setup routine runs once when you press reset:
void setup() {
  // declare pin 9 to be an output:
  pinMode(R, OUTPUT);
  pinMode(G, OUTPUT);
  pinMode(B, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {

 // Change the value to make cool combinations
  analogWrite(R, 50);
  analogWrite(G, 100);
  analogWrite(B, 150);

}

You only have to change the value of analogWrite for making new colors.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
YouTube
× Contact us