Re: Digitally controlled 8x RGB LED Light Strip (HCMODU0075)
Posted: Mon Apr 13, 2015 9:32 am
I'm not sure why it would be doing that but I can see that your code is indexing outside of the array which can cause all sorts of weird things to happen. Try this:
Code: Select all
/* Step forward through each LED */
for(index = 0; index < NUMBEROFLEDS; index++)
{
HCWS2812.ClearBuffer();
RGBBuffer[RED][index] = 85;
if(index)
RGBBuffer[RED][index-1] = 15;
HCWS2812.Refresh();
delay(100);
}
/* Step backward through each LED */
for(index = NUMBEROFLEDS; index; index--)
{
HCWS2812.ClearBuffer();
RGBBuffer[RED][index - 1] = 85;
if(index < NUMBEROFLEDS)
RGBBuffer[RED][index] = 15;
HCWS2812.Refresh();
delay(100);
}