r/FastLED • u/dorcu • Nov 05 '23
Support How can I achieve pattern repetition and simultaneous execution?
Hello. I have 12 modules, each module consists of 3 subgroups of 10 LEDs, arranged in a three-blade helix, similar to nanoleaf. Each module can connect to another module from each of the 3 ends. How should I make the 3 subgroups of 10 LEDs have the same pattern, and have all the modules run simultaneously? For example, the fire effect.
I have a nodeMcu with leds WS2812
2
Upvotes
1
u/dorcu Nov 06 '23
I think it would be easier without the groups of 30 LEDs divided into strips of 10 LEDs being in parallel instead of in series. It's right?
Since that way I would only have to do the effects with 10 LEDs and they would be replicated automatically and synchronously without having to make groups and subgroups.
The bad thing is that I won't be able to generate effects like in this set of LEDs, but I can't find any other way to do it.
https://shop.moonside.design/products/moonside-neon-hex
2
u/UrbanPugEsq Nov 05 '23
So, to control the LEDs you would just write whatever patterns you want to the array or arrays that are sent to the strips. Marc’s answer is correct if you want exact copies (you might not if it’s fire, but that really an artistic decision).
To have the nodes run synchronously, you need to come up with a way for them to communicate. There are lots of ways. You could have all of the devices receive artnet and control them all directly that way. You could implement mqtt messaging, you could just open sockets and have them pass data that way.
You could also run OSC commands (which are a way of passing short messages over UDP). That’s how I control my LED project - TouchOSC sends commands and the esp32 listens.
It seems like you need to go build and then once you have specific issues people here can probably give you more helpful advice, as opposed to merely the abstract.
1
u/Marmilicious [Marc Miller] Nov 05 '23 edited Nov 05 '23
Once you've set the pixels for one of the 3 subgroups you can duplicate the pixel data to the other two subgroups before calling FastLED.show() so they will always match. You can use a simple for loop to copy the data, or memmove8.
This example uses a for loop to copy some pixel data to other pixels before callings show().
https://github.com/marmilicious/FastLED_examples/blob/master/mirrored_Fire2012.ino
These two examples use memmove8.
https://github.com/marmilicious/FastLED_examples/blob/master/memmove8_pattern_copy.ino
https://github.com/marmilicious/FastLED_examples/blob/master/memmove8_example.ino