I have two 1 meter strands of 2812s wired in series. I'm trying to treat them as 2 different strands instead of one long one. I'm trying to make the lights chase from center to ends.
I am trying to get them to start at the same time. The further part of the strand starts first, then about 1/4 of a second later, the closer strand starts its light chase towards the data in side.
I started with an example program and I'm slowly adding things one part at a time to work my project up to the end goal. So, I'll post the code, everyone should recognize the basic parts. The extra parts are parts I've added to make the different parts "stand alone".
My end goal is to have 6-8 strands total that sequence together so I REALLY need to figure out how to fix the timing issues from one strand to the next. I'm also going to have 20-30' of distance between strands that I think will also cause timing issues. Currently the data line is about 4" from the Arduino, with no physical break in the strands. Its actually one continuous strand that I'm trying to treat as 2 strands. So distance should not be an issue at this point.
Thanks for any help.
#include <PololuLedStrip.h>
// Create an ledStrip object and specify the pin it will use.
PololuLedStrip<12> ledStrip;
// Create a buffer for holding the colors (3 bytes per color).
rgb_color colors[60];
byte time = millis() >> 2;
byte x = 0;
byte y = 0;
rgb_color LEDupdate1(rgb_color colors);
rgb_color LEDupdate2(rgb_color colors);
void setup()
{
}
void loop()
{
time = millis() >> 2;
colors[60] = LEDupdate1(colors);
colors[60] = LEDupdate2(colors);
// Write the colors to the LED strip.
ledStrip.write(colors, 60);
delay(10);
}
rgb_color LEDupdate1(rgb_color colors[60])
{
// Update the colors.
for(uint16_t i = 0; i < 30; i++)
{
x = time + 8*i;
colors = (rgb_color){ x, 255 - x, x };
-
}*
-
return colors[60];*
}
rgb_color LEDupdate2(rgb_color colors[60])
{
-
// Update the colors.*
-
for(uint16_t i = 30; i < 60; i++)*
-
{*
_ y = time - 8i;_
colors = (rgb_color){ y, 255 - y, y };
_ }*_
* return colors[60];*
}