Does FastLED Multi-Controller allow for irregular length strips?
I'm prototyping a sign project where the letters of a word will have strips of WS2812Bs outlining them. The circumference/area of each letter varies, which is going to result in irregular lengths of LED strips. For instance, for an 8 inch tall letter E, I've roughly calculated that I'll need to cut a strip of 140 LED "pixels" using the compact 144 per meter strips, but an 8 inch tall letter A will require only 82 LED "pixels" to wrap around it.
I'd like to use the Multiple Controller feature by simply setting up the strips together, but with the varying lengths. For example:
void setup() {
FastLED.addLeds<NEOPIXEL, 4>(leds, 42);
FastLED.addLeds<NEOPIXEL, 5>(leds, 150);
FastLED.addLeds<NEOPIXEL, 6>(leds, 88);
FastLED.addLeds<NEOPIXEL, 7>(leds, 900); // or whatever
}
I've been scouring all the documentation I can find for the past few hours and have come up stumped as to whether this is supported, and also if there is a simple way to manage looping over the length of each unequal strip in equal time?
Posted Jun 16, 2019, 3:57 AM UTC
Yes, I think there should be no problem with unequal lengths.
As for your looping over in equal time, look no further than the amazing beat functions in FastLED. Beat8() will give a rising 0 - 255 value given a BPM value.
You can use it as follows, an example, where a dot moves each strip and leaves a fading trail:
Where:
Lerp8by8 interpolates the 0 - 255 value to the 0 to NUM_LEDS.
There's also beatsin8() which moves back and forth instead of one way. Check out the other cool math functions in FastLED: http://fastled.io/docs/3.1/group__lib8tion.html
EDIT: the nice thing is that it doesn't matter how often you call this function. So no need for delay() to get timing and speed right. Although if you don't call it often enough, it will start to leave gaps.
Excellent solution!
Thanks! :)
Yes! This is awesome. Thank you.
I couldn't quite determine if most of those math functions were for public consumption, or if they were somewhat useful internal implementation details that could be used as a tangential library. I'll dig into them a bit more.
Ha, even if they were used for internal, if you can access them, why not use them?
Also you can combine them with the wave functions: https://github.com/FastLED/FastLED/wiki/FastLED-Wave-Functions
u/costynvd - Very creative way to replace a “for loop”!
Thanks! Yea I find these functions so elegant that I try to always write my patterns using one of these. I have a scheduler which calls the pattern function every x millseconds or microseconds if necessary, if it's a fast moving pattern.
The scheduler also takes care of many other things (all at once, mind you):