Is there any straight forward way to say take a strip of 40 led

fastled-support
gplus
(Matt) #1

Is there any straight forward way to say take a strip of 40 led and make it so it’s two strips? 20 and 20?

(Chris Parton) #2

Do you mean you want to represent your single LED strip as two strips in FastLED? If so, then take a look at CRGBSet. This is a good gist to get you started: https://gist.github.com/chemdoc77/80ab638588399c9a09e26a296d56f6e6
https://gist.github.com/chemdoc77/80ab638588399c9a09e26a296d56f6e6

(Marc Miller) #3

Can you explain a bit more about what you’re wanting to do?

(Andrew Tuline) #4

I cut the strips in the middle so I’ll have a 20 and 20. I can then either hook them together in a serpentine fashion, usually in a ‘Y’ pattern for my projects or, if they’re WS2812’s, hook up up to separate pins. All depends on what I have and what I want to do.

(Matt) #5

So, it’s for a costume, trying not to have wires from the board all over the place. Already mirrored this strip once and read it can mess up if you do 4 off the same data. Here’s what i have for this strip only(there’s 4 other sets of lights) and was trying to achieve this on this one so I could have the same effect on all 4 at once.

(Chris Parton) #6

The problem with that layout is that you’re connecting Data Out on strips 1 and 3 to Data Out on strips 2 and 4, respectively (with strips numbered from top to bottom).

You need to either reverse the direction of strips 2 and 4 and account for that in your code, or you need to run the data line back to the first LED in strips 2 and 4.

(Matt) #7

@Chris_Parton That’s why I was hoping to split strips without making wiring more complex, cause there is a ‘reverse direction’ that’s pretty easy to do.

(Yves BAZIN) #8

@Matt12
As @Chris_Parton said you ‘reverse’ the direction of strip 3 and 4 so the data out goes in the data in.
Then in your code if you want to replicate the content of strip 1 in strip 2
Inum_leds represent your total number of leds (40 in your case)
leds[] is thebarray with all you leds
First populate your pattern of the first strip
Then
For (int i=0;i<num_leds/2;i++)
leds[num_leds-i-1]=leds[i];
This will copy the pattern to the second strip

And if you have 4 strips
Plug them all together in a snake pattern
It will look
—->
<—-
—->
<—-
This way only one data wire from your mcu to the strips
Then adapt the code above
int strip_length=num_leds/4; //here num_leds=80 for your case

for(int i=0;i<strip_length<i++)
{
leds[2strip_length-i-1]=leds[i];
leds[2
strip_length+i ]=leds[i];
leds[4*strip_length-1-i]=leds[i];
}
This will copy the pattern of the first strip to all the other strips.

(Matt) #9

@Yves_BAZIN @Chris_Parton Just to clarify, I’m not connecting to the Data Out, I’m just running the strips reverse.(Intended to reverse pattern on those)

(Yves BAZIN) #10

@Matt12 I meant you do not need to have two data pins.
Red =5v $
black=GND
Green =Data line
the code i gave you will duplicate the data of the first strip to all the other strips taking also into account the strips which are reversed
missing/deleted image from Google+

(Matt) #11

@Yves_BAZIN Ahh I gotcha.Well I was thinking it’d be hard enough to do 1 reverse in a strip let alone a back and forth… I’ll give that a shot!

(Yves BAZIN) #12

Hello @Matt12 let me know if it works ( normally it should).
I made a typo
It’s for(int i=0;i<strip_length;i++) of course :wink:

(Matt) #13

I assume this would work for different lengths as well?

(Marc Miller) #14

Might make the code just a bit more complicated, but yes.

(Yves BAZIN) #15

@Matt12
If each strip are of different lengths as @marmil said ,it will be a bit more complicated but feasible.

(Matt) #16

@Yves_BAZIN So, related to the last question(different project). I am messing with the Fire2012 demo and trying to take one strand of led(single data) and split it into 3 fires. I split the numbers(they aren’t equal) for 3 functions but it doesn’t work. Is that because I can’t assign the colors to the leds like that?

(Yves BAZIN) #17

@Matt12 like that I can’t say really.

  1. could you post your code on gist ?
  2. what do you mean by ‘split’ ?
  3. did the code I gave you worked?