Digitally controlled 8x RGB LED Light Strip (HCMODU0075)

LCD, TFT, OLED, LED modules
andrew
Site Admin
Posts: 796
Joined: Sun Aug 05, 2012 4:15 pm

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

Post by andrew » 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);
  }
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

andrew
Site Admin
Posts: 796
Joined: Sun Aug 05, 2012 4:15 pm

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

Post by andrew » Mon Apr 13, 2015 11:48 am

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.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

humbm0
Posts: 1
Joined: Sun Mar 12, 2017 3:57 pm

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

Post by humbm0 » Sun Mar 12, 2017 4:01 pm

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.

andrew
Site Admin
Posts: 796
Joined: Sun Aug 05, 2012 4:15 pm

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

Post by andrew » Mon Mar 13, 2017 10:43 am

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.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply