KY-011 Two Color LED module

Click Here to View Step by Step

KY-011 Two Color LED module


Short description :

The KY-011 Two Color LED module emits red and green light. You can adjust the intensity of each color using PWM.

Working with  (Compatible)

Arduino, ESP32, Nodemcu, ESP8266, Raspberry Pi, and ......

KY-011 Two Color LED module

KY-011 Two Color LED module

ARDUINO IDE CODE 

Example description :

Arduino sketch will gradually alternate between red and green colors.

int redpin = 11; // pin for red signal
int greenpin = 10; // pin for green signal
int val;
void setup() {
  pinMode(redpin, OUTPUT);
  pinMode(greenpin, OUTPUT);
}
void loop() {
  for(val = 255; val > 0; val--) { 
    analogWrite(redpin, val); //dim red
    analogWrite(greenpin, 255 - val); // brighten green
    delay(15);
  }
  for(val = 0; val < 255; val++) { 
    analogWrite(redpin, val); //brighten red
    analogWrite(greenpin, 255 - val); //dim green
    delay(15);
  }
}