RGB LED Module
RGB full color LED Module for Arduino emits a range of colors by mixing
red, green and blue. The amount of each primary color is adjusted using
PWM.
This module consists of a 5mm RGB LED and three 150Ω limiting resistors
to prevent burnout. Adjusting the PWM signal on each color pin will result
on different colors.
Operating Voltage 5V
LED drive mode Common cathode
LED diameter 5 mm
Operating Voltage 5V
Pinout and Connection to Arduino
Connect the red pin (R) on the KY-016 to pin 11 on the Arduino. Blue (B) to pin 10, green (G) to pin 9
and ground (-) to GND. Notice that you do not need to use limiting resistors since they are already
included on the board.
Module Arduino KY-016
R Pin 11 R
B Pin 10 B
G Pin 9 G
- GND -
Arduino Example Sketch
The following Arduino sketch will cycle through various colors by changing the PWM value on each of
the three primary colors.
int redpin = 11; //select the pin for the red LED
int bluepin =10; // select the pin for the blue LED
int greenpin = 9;// select the pin for the green LED
int val;
void setup() {
pinMode(redpin, OUTPUT);
pinMode(bluepin, OUTPUT);
pinMode(greenpin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
for(val = 255; val > 0; val--)
{
analogWrite(redpin, val); //set PWM value for red
analogWrite(bluepin, 255 - val); //set PWM value for blue
analogWrite(greenpin, 128 - val); //set PWM value for green
Serial.println(val); //print current value
delay(1);
}
for(val = 0; val < 255; val++)
{
analogWrite(redpin, val);
analogWrite(bluepin, 255 - val);
analogWrite(greenpin, 128 - val);
Serial.println(val);
delay(5);
}
}