Hi Simba!
That looks like a very cool project!
To shorten your code you can use for-loops.
Any time you see code repeat in your sketch: think about using loops, for-loop being one of them. See also: Arduino Programming for Beginners – Part 5: Going in Loops.
For example:
FastLED.addLeds<WS2812B, 22>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 23>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 24>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 25>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 26>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 27>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 28>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 29>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 30>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 31>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 32>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 33>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 34>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 35>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 36>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 37>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 38>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 39>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 40>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 41>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 42>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 43>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 44>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 45>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 46>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 47>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 48>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 49>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 50>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 51>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 52>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, 53>(leds, NUM_LEDS);
Could be written as:
for(int PinForStrip = 22; PinForStrip <= 53; PinForStrip ++) {
FastLED.addLeds<WS2812B, PinForStrip>(leds, NUM_LEDS);
}
Note that in your code ALL LEDs are added to the “leds” array. I’m not sure if that was intentional or not.
If it is, then your LEDs array has 32×300 LEDs in it, and separately calling an effect for each strand should not really work.
Just calling Strobe once would affect all 9600 LEDs (as far as I understand the documentation – I do not have that many LED strips available).
Also note, that since you’re using FastLED, you could optimize and simplify the code some more.
You can replace showStrip() function by calling the FastLED’s show() function directly instead.
If you do so, the showStrip function can be removed from the code.
Setting all colors to one given color (black) can be done faster in FastLED as well.
Either by using “showColor(CRGB(Red,Green,Blue))” or in case all LEDs should be off, we could use “Clear()” as well.
On that note: if all strands should show the exact same effect, you can just connect all Data-in pins of the strands to one and the same pin on the Arduino.
But seeing the effect in the example video, I can imagine this is not what you have in mind.