3 color – full color LED module
Buy the 37 in 1 kit at Amazon
Contents
- 1 Overview
- 2 Specifications
- 3 Schematic
- 4 Example code
- 5 Simple demo without cables
- 6 Example code random
Overview
RGB LED module consists of a plug-in full color LED made by R, G, B three pin PWM voltage input can be adjusted Section three primary colors (red / blue / green) strength in order to achieve full color mixing effect. Control of the module with the Arduino can be achieved Cool lighting effects.
Specifications
- the use of plug-in full-color LED
- RGB trichromatic limiting resistor to prevent burnout
- through the PWM adjusting three primary colors can be mixed to obtain different colors
- with a variety of single-chip interface
- the working voltage: 5V
- LED drive mode: common cathode driver
Schematic
- Arduino pin 11 –> Pin R module
- Arduino pin 10 –> Pin G module
- Arduino pin 9 –> Pin B module
- Arduino pin GND –> Pin – module
You don’t need any resistors, these are already included on the module.
Example 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); } }