Flexible Digitally Controlled RGB LED strips (HCOPTO0028)
Posted: Fri Mar 27, 2015 2:31 pm
A flexible full colour RGB LED light strip (HCOPTO0028). Each LED within the strip can be individually controlled to display any one of over 16 million colours. Each LED is connected in a serial chain meaning that each LED can be controlled with only one digital pin on a microcontroller. The strips are based on the WS2812 addressable RGB LEDs and are sold in with 30 LED strips or 5 meter reels.
What's more, to make controlling these LED's from an Arduino as simple as possible we have written our own exclusive library what will handle all the complicated bits. See our forum or blog for more information on this library and requirements.
Product code: HCOPTO0028
Working voltage: 5V
Max current: 60mA per LED
Length per 30 LED strip: 50cm
Length per reel: 500cm
+5V.......5V Supply
DI..........Serial data in
DO.........Serial data out
GND.......0V
Code: Select all
/* FILE: HCWS2812_Cylon_Example
DATE: 26/03/15
VERSION: 0.1
AUTHOR: Andrew Davies
11/03/15 version 0.1: Original version
This is an example of how to use the HCMAX7219 library to control one or more
RGB LEDS. The example will set each LED to a random colour.
To use this example connect one or more LEDs in series (Dout --> Din) and connect
the first LED's Din pin to digital pin 8 of your Arduino.
By default the library is set to control 100 LEDs. You can change this by editing the
following line in the MCMAX7219.h header file:
#define NUMBEROFLEDS 200 <--- Change this number to match the number of LEDS connected
You can download the library from the software section of our support forum here:
http://forum.hobbycomponents.com/viewforum.php?f=58
Or from Github here:
https://github.com/HobbyComponents/HCWS2812
You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.
THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/
/* Include the HCWS2812 library */
#include "HCWS2812.h"
/* Create an instance of the library */
HCWS2812 HCWS2812;
void setup()
{
/* Set the R,G,B background colours to zero */
HCWS2812.SetBG(0, 0, 0);
/* Clear the output buffer */
HCWS2812.ClearBuffer();
}
/* Main program */
void loop()
{
int index;
/* Step forward through each LED */
for(index = 0; index < NUMBEROFLEDS; index++)
{
HCWS2812.ClearBuffer();
RGBBuffer[RED][index] = 255;
HCWS2812.Refresh();
delay(100);
}
/* Step backward through each LED */
for(index = NUMBEROFLEDS; index; index--)
{
HCWS2812.ClearBuffer();
RGBBuffer[RED][index - 1] = 255;
HCWS2812.Refresh();
delay(100);
}
}
Code: Select all
/* FILE: HCWS2812_Random_Example
DATE: 26/03/15
VERSION: 0.1
AUTHOR: Andrew Davies
11/03/15 version 0.1: Original version
This is an example of how to use the HCMAX7219 library to control one or more
RGB LEDS. The example will set each LED to a random colour.
To use this example connect one or more LEDs in series (Dout --> Din) and connect
the first LED's Din pin to digital pin 8 of your Arduino.
By default the library is set to control 100 LEDs. You can change this by editing the
following line in the MCMAX7219.h header file:
#define NUMBEROFLEDS 200 <--- Change this number to match the number of LEDS connected
You can download the library from the software section of our support forum here:
http://forum.hobbycomponents.com/viewforum.php?f=58
Or from Github here:
https://github.com/HobbyComponents/HCWS2812
You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.
THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/
/* Include the HCWS2812 library */
#include "HCWS2812.h"
/* Create an instance of the library */
HCWS2812 HCWS2812;
void setup()
{
/* Set the R,G,B background colours to zero */
HCWS2812.SetBG(0, 0, 0);
/* Clear the output buffer */
HCWS2812.ClearBuffer();
}
void loop()
{
int index;
/* Fill the output buffer with random colours */
for(index = 0; index < NUMBEROFLEDS; index++)
{
RGBBuffer[RED][index] = random(0,255);
RGBBuffer[GREEN][index] = random(0,255);
RGBBuffer[BLUE][index] = random(0,255);
}
/* Send the output buffer to the LEDs */
HCWS2812.Refresh();
/* Wait a moment before doing it again */
delay(100);
}
The library files can be downloaded from github here:
https://github.com/HobbyComponents/HCWS2812
Or directly from this forum:
http://forum.hobbycomponents.com/viewto ... =58&t=1799
Datasheet:
Disclaimer: Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.
Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.