Iduino SE037 User guide

Page 1
IDUINO for Maker’s life
User Manual
for
SMD RGB LED Module (SE037)
www.openplatform.cc
Page 2
“R”
Red light
“G”
Green light
“B”
Blue light
“-”
Ground
IDUINO for Maker’s life
Introduction
RGB LED module consists of a full-color LED made by R, G, B three pin PWM voltage input can be adjusted. Primary colors (red/blue / green) strength in order to achieve full color mixing effect. Control the module with the Arduino can be achieved Cool lighting effects.
Pinout
Pin Name Description
www.openplatform.cc
Page 3
IDUINO for Maker’s life
Example
In this example, we blink a LED and using an RGB LED we can generate any color we want.
Wire connection as below,
“V”-----------5V
R-------------------D10
“G”-------------------D11
“B”-------------------D9
********Code begin********
int ledDigitalOne[] = {10, 11, 9};
//10 = redPin, 11 = greenPin, 9 = bluePin const boolean ON = HIGH;
const boolean OFF = LOW; const boolean RED[] = {ON, OFF, OFF}; const boolean GREEN[] = {OFF, ON, OFF}; const boolean BLUE[] = {OFF, OFF, ON}; const boolean YELLOW[] = {ON, ON, OFF}; const boolean CYAN[] = {OFF, ON, ON}; const boolean MAGENTA[] = {ON, OFF, ON}; const boolean WHITE[] = {ON, ON, ON}; const boolean BLACK[] = {OFF, OFF, OFF}; const boolean* COLORS[] = {RED, GREEN, BLUE, YELLOW, CYAN, MAGENTA, WHITE, BLACK}; void setup(){ for(int i = 0; i < 3; i++){ pinMode(ledDigitalOne[i], OUTPUT); } } void loop(){ /* Example - 1 Set a color Set the three LEDs to any predefined color */ setColor(ledDigitalOne, YELLOW); //Set the color of LED one /* Example - 2 Go through Random Colors Set the LEDs to a random color */ //randomColor(); } void randomColor(){ int rand = random(0, sizeof(COLORS) / 2); //get a random number within the range of colors setColor(ledDigitalOne, COLORS[rand]); //Set the color of led one to a random color delay(1000); }
www.openplatform.cc
Page 4
IDUINO for Maker’s life
/* Sets an led to any color led - a three element array defining the three color pins (led[0] = redPin, led[1] = greenPin, led[2] = bluePin) color - a three element boolean array (color[0] = red value (LOW = on, HIGH = off), color[1] = green value, color[2] =blue value) */ void setColor(int* led, boolean* color){ for(int i = 0; i < 3; i++){ digitalWrite(led[i], color[i]); } } /* A version of setColor that allows for using const boolean colors */ void setColor(int* led, const boolean* color){ boolean tempColor[] = {color[0], color[1], color[2]}; setColor(led, tempColor); }
********Code End********
www.openplatform.cc
Loading...