3-color LED Module
With red, green and blue output
Great for DIY project
THIS MODULE DOES NOT INCLUDE CURRENT LIMITING RESISTORS. This allows the module to be used with a range of supply voltages but you must drive the LED's via an appropriate current limiting resistor otherwise damage to the LED's will occur. We will be adding an example of how to correctly drive the LED's to this page soon.
Please note that the current version of this module has a screen print error showing wrong colour order for the pinout. Please see the table below for the correct pinout.
Red LED Vf : 2V (approx)
Green LED Vf : 3V (approx)
Blue LED Vf : 3V (approx)
Red LED Max Ifmax : 20mA
Green LED Max Ifmax : 20mA
Blue LED Max Ifmax : 20mA
cellspacing="1">
style="font-size: 20px;">PINOUT |
---|
PIN |
DESCRIPTION |
1 |
GREEN LED |
2 |
RED LED |
3 |
BLUE LED |
4 |
GND |
EXAMPLE CODE
ARD_RGB_LED_MODULE_HCARDU0021_Example.pde/* FILE: ARD_RGB_LED_MODULE_HCARDU0021_Example.pde
style="color: rgb(126, 126, 126);"> DATE: 04/07/12
style="color: rgb(126, 126, 126);"> VERSION: 0.1
style="color: rgb(126, 126, 126);">This is a simple example of how to use the HobbyComponents RGB LED module
style="color: rgb(126, 126, 126);">(HCARDU0021). The module has 3 separate LED's (Red, Green & Blue) which
style="color: rgb(126, 126, 126);">Can be individually driven by applying a voltage to the appropriate module pin.
style="color: rgb(126, 126, 126);">This example uses the standard Arduino analogWrite (PWM) function to cycle
style="color: rgb(126, 126, 126);">through the full range of colours this module is capable of producing.
style="color: rgb(126, 126, 126);">Please be aware that this module does NOT include current limiting
style="color: rgb(126, 126, 126);">resistors and therefore you should not connect this module directly to the
style="color: rgb(126, 126, 126);">Arduino DIO pins.
style="color: rgb(126, 126, 126);">SENSOR PINOUT:
style="color: rgb(126, 126, 126);">PIN 1: GREEN LED +Ve
style="color: rgb(126, 126, 126);">PIN 2: RED LED +Ve
style="color: rgb(126, 126, 126);">PIN 3: BLUE LED +Ve
style="color: rgb(126, 126, 126);">PIN 4: GND
style="color: rgb(126, 126, 126);">You may copy, alter and reuse this code in any way you like but please leave
style="color: rgb(126, 126, 126);">reference to HobbyComponents.com in your comments if you redistribute this code. */
#define BLUE_LED_DIO 11 style="color: rgb(126, 126, 126);">/* Select the DIO for driving the BLUE LED */
#define RED_LED_DIO 9 style="color: rgb(126, 126, 126);">/* Select the DIO for driving the RED LED */
#define GREEN_LED_DIO 10 style="color: rgb(126, 126, 126);">/* Select the DIO for driving the GREEN LED */
style="color: rgb(126, 126, 126);">/* Initialise serial and DIO */
style="color: rgb(204, 102, 0);">void style="color: rgb(204, 102, 0);">setup()
{
style="color: rgb(126, 126, 126);">/* Configure the DIO pins used by the analogWrite PWM function */
style="color: rgb(204, 102, 0);">pinMode(BLUE_LED_DIO, style="color: rgb(0, 102, 153);">OUTPUT);
style="color: rgb(204, 102, 0);">pinMode(RED_LED_DIO, style="color: rgb(0, 102, 153);">OUTPUT);
style="color: rgb(204, 102, 0);">pinMode(GREEN_LED_DIO, style="color: rgb(0, 102, 153);">OUTPUT);
}
style="color: rgb(126, 126, 126);">/* Main program loop */
style="color: rgb(204, 102, 0);">void style="color: rgb(204, 102, 0);">loop()
{
style="color: rgb(204, 102, 0);">int k;
style="color: rgb(126, 126, 126);">/* Slowly reduce the red LED's intensity and at the same time
style="color: rgb(126, 126, 126);"> increase the green LED's intensity */
style="color: rgb(204, 102, 0);">for (k = 0; k <=255; k++)
{
style="color: rgb(204, 102, 0);">analogWrite(RED_LED_DIO,255 - k);
style="color: rgb(204, 102, 0);">analogWrite(GREEN_LED_DIO, k);
style="color: rgb(204, 102, 0);">delay(10);
}
style="color: rgb(126, 126, 126);">/* Slowly reduce the green LED's intensity and at the same time
style="color: rgb(126, 126, 126);"> increase the blue LED's intensity */
style="color: rgb(204, 102, 0);">for (k = 0; k <=255; k++)
{
style="color: rgb(204, 102, 0);">analogWrite(GREEN_LED_DIO,255 - k);
style="color: rgb(204, 102, 0);">analogWrite(BLUE_LED_DIO, k);
style="color: rgb(204, 102, 0);">delay(10);
}
style="color: rgb(126, 126, 126);">/* Slowly reduce the blue LED's intensity and at the same time
style="color: rgb(126, 126, 126);"> increase the red LED's intensity */
style="color: rgb(204, 102, 0);">for (k = 0; k <=255; k++)
{
style="color: rgb(204, 102, 0);">analogWrite(BLUE_LED_DIO,255 - k);
style="color: rgb(204, 102, 0);">analogWrite(RED_LED_DIO, k);
style="color: rgb(204, 102, 0);">delay(10);
}
}