KY-016 3-color LED module

9,148

 

The KY-016 3-color LED module.

The KY-016 RGB LED module consists of a tri color LED, you can adjust the intensity of the three primary colors (red / blue / green) by altering the PWM voltage inputs of the R, G and B pins to achieve full color mixing.

 

Connection

 

KY-016Arduino
RPin 11
BPin 10
GPin 9
GND

 

Code

//KY016 3-color LED module
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 (11, val);
    analogWrite (10, 255-val);
    analogWrite (9, 128-val);
    delay (10);
    Serial.println (val, DEC);
  }
  for (val = 0; val <255; val ++)
  {
    analogWrite (11, val);
    analogWrite (10, 255-val);
    analogWrite (9, 128-val);
    delay (10);
    Serial.println (val, DEC);
  }
}

Links

37 in 1 box Sensor Kit For Arduino Starters brand in stock

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.