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.
Components :
- Arduino Uno
- Jumper Wires
- Breas Board
- RGB Led
RGB pinout :
- GND –> GND
- R –> D9
- G –> D10
- B –> D11
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.
Good day! I just want to offer you a big thumbs up for your excellent information you have got here on this post. Ill be coming back to your blog for more soon.