949
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-016 | Arduino |
R | Pin 11 |
B | Pin 10 |
G | Pin 9 |
– | GND |
Code
[codesyntax lang=”cpp”]
//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); } }
[/codesyntax]
Links
37 in 1 box Sensor Kit For Arduino Starters brand in stock