Hello! I'm fairly new to programming and FastLED, but this really has me stuck.

(James) #1

I’m fairly new to programming and FastLED, but this really has me stuck.

I have 3 different length strips running in different directions.
The first is 100 WS2811 on pin 5 running left to right as 99-0.
The second is 144 WS2812b on pin 7 running left to right 100-243
The third is 40 ws2811 on pin 9 running left to right 244-283.

I am trying to work out how to run a single gradient across all 3 in the correct order.

Here is my code currently, but I wondering if there is any easy way to reverse the order of the first strip:



(Dushyant Ahuja) #2

I think what you need is multiple led arrays here. Then you can mirror one and keep the rest same. Also look at CRGBSets. https://github.com/FastLED/FastLED/wiki/RGBSet-Reference

(Marc Miller) #3

@James1 Can you clarify, are the strips end to end? You said “running different directions”, but also said they are all running left to right. Please provide a photo or sketch, or otherwise further clarify.

There are multiple solutions, but some could be better based on how things are actually arranged.

To reverse a section of pixels you can run something like this right before you call show().
for (uint8_t i = 0; i < someNumber ; i++) {
CRGB temp = leds[i];
leds[i] = leds[ someNumber - 1 - i ];
leds[ someNumber - 1 - i ] = temp;

Operating on a temporary CRGB array and them appropriately copying (and shuffling the order as needed) to the CRGB array(s) that get displayed is another option.

Mapping your display is yet another slightly more complex solution.

(варешяф рйезот) #4