KY-016 RGB FULL COLOR LED MODULE
Short description :
The KY-016 Full Color RGB LED emits a wide range of different colors by mixing red, green & blue light.
Working with (Compatible)
Arduino, ESP32, Nodemcu, ESP8266, Raspberry Pi, and ......
ARDUINO IDE CODE
Example description :
The following Arduino sketch will gradually increase/decrease the PWM values on the red, green & blue pins causing the LED to cycle through various colors.
int redpin = 8; // select the pin for the red LED
int bluepin =9; // select the pin for the blue LED
int greenpin =10; // 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(11, val);
analogWrite(10, 255 - val);
analogWrite(9, 128 - val);
Serial.println(val, DEC);
delay(5);
}
for(val = 0; val < 255; val++)
{
analogWrite(11, val);
analogWrite(10, 255 - val);
analogWrite(9, 128 - val);
Serial.println(val, DEC);
delay(5);
}
}