Page 2 of 2

Re: Digitally controlled 8x RGB LED Light Strip (HCMODU0075)

Posted: Mon Apr 13, 2015 9:32 am
by andrew
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);
  }

Re: Digitally controlled 8x RGB LED Light Strip (HCMODU0075)

Posted: Mon Apr 13, 2015 11:48 am
by andrew
I've now updated the header file to provide correct timings for newer versions of Arduino IDE. Once everything is confirmed to work I'll move these posts to the software section as they are kind of off topic here.

One other thing to note is that at some point I plan to make a further update to the library to free up some memory.

Re: Digitally controlled 8x RGB LED Light Strip (HCMODU0075)

Posted: Sun Mar 12, 2017 4:01 pm
by humbm0
How can I use the HCWS2812.h through two pins? So using pin 8 and 2? I need to control two strips independently and through two different pins.

Re: Digitally controlled 8x RGB LED Light Strip (HCMODU0075)

Posted: Mon Mar 13, 2017 10:43 am
by andrew
How can I use the HCWS2812.h through two pins? So using pin 8 and 2? I need to control two strips independently and through two different pins.
It can only drive one pin I'm afraid. Is there any reason why you can't just attach the data input of the second strip to the data output of the first? The library allows you to control every LED individually so there's no reason why you can't treat them as two separate groups of LED's even though they are connected together.