Is it good practice to only have FastLED.show();

Is it good practice to only have FastLED.show(); used once in the main loop so that all the Led’s are written there together, rather than having them called many times in functions throughout the program?

I’ve heard that this technique (not necessarily with FastLED) can help create smoother animations …

I do this as well.

True, its usually a good idea to only refresh the LEDs only when needed. Think of the process like an animtaion cell

@Andreas_Pleschutznig can you think of any examples where logic might need it called more than once?

I write all my animations like a game loop – complete with logic(uint16_t elapsedMs) and render() calls in the main loop. In logic() I check inputs and update the CRGB array, and in render() I call FastLED.show(). Outside of this I do any framerate-limiting that may be appropriate.

Even without a framerate-limiter, decoupling the updates using a delta-time value allows you to make accurate time-based calculations rather than doing something “X times per frame”.

What I do is: A) Have all animation parameters based on millis or wave functions. B) Render the complete frame and C) Call FastLED.show() once. Repeat this as often as possible and your animations become smooth.
Sideeffect: The time-based animations look on any led setup and with any processor speed the same - just with different fps rates - and by this appearing more or less smooth. :slight_smile:

@Luminous_Elements that’s very interesting. I’ve never seen any game design but this makes sense. This is turning into a much more useful discussion than I anticipated!