RGB LED
RGB
LED means red, blue and green LEDs. RGB LED products
combine these three colors to produce over 16 million hues of light. Note
that not all colors are possible. Some colors are “outside” the triangle formed
by the RGB LEDs. Also, pigment colors such as brown or pink are difficult,
or impossible, to achieve.
It can be used in different applications such as outdoor
decoration lighting, stage lighting designs, home decoration lighting, LED
matrix display, and more. RGB LEDs have three internal LEDs (Red, Green, and
Blue) that can be combined to produce almost any color output.
RGB LED Pins
RGB LEDs have four
leads—one for each LED and another for the common anode or cathode. You can
identify each lead by its length, as shown in the following figure.
With the LED facing
you so the anode or cathode (the longest lead) is second from the left, the
leads should be in the following order: red, anode or cathode, green, and blue.
How to use RGB LED
REQUIRED MATERIALS,
Arduino uno----
https://m.banggood.com/beelink/muvGs8
RGB LEDs---- https://m.banggood.com/beelink/ruvSEI
Jumper wires----https://m.banggood.com/beelink/muvGsx
Bread board---- https://m.banggood.com/beelink/ruzGst
Step 01: Create Circuit Diagram on Bread Board
Step
02: Programming
int
red_pin= 3;
int
green_pin = 4;
int
blue_pin = 5;
void
setup() {
pinMode(red_pin, OUTPUT);
pinMode(green_pin, OUTPUT);
pinMode(blue_pin, OUTPUT);
}
void
loop() {
RGB_color(255, 0, 0); // Red
delay(1000);
RGB_color(0, 255, 0); // Green
delay(1000);
RGB_color(0, 0, 255); // Blue
delay(1000);
RGB_color(255, 255, 125); // Raspberry
delay(1000);
RGB_color(0, 255, 255); // Cyan
delay(1000);
RGB_color(255, 0, 255); // Magenta
delay(1000);
RGB_color(255, 255, 0); // Yellow
delay(1000);
RGB_color(255, 255, 255); // White
delay(1000);
}
void
RGB_color(int red_value, int green_value, int blue_value)
{
analogWrite(red_pin, red_value);
analogWrite(green_pin, green_value);
analogWrite(blue_pin, blue_value);
}
Step
03: Test
0 Comments