how would you implement a “blackout” function?
i.e the use hits blackout control, and all strips/leds go out.
i’m thinking:
void blackout (void) {
FastLED.clear();
FastLED.show();
}
Any better ideas?
how would you implement a “blackout” function?
i.e the use hits blackout control, and all strips/leds go out.
i’m thinking:
void blackout (void) {
FastLED.clear();
FastLED.show();
}
Any better ideas?
That’s how I do it as it seems the simplest and most readable. Another option would be to replace:
FastLED.clear();
with:
memset8(leds, 0, NUM_LEDS * 3);
which might be faster if you had a large number of pixels.
If you look at the source for FastLED.clear(), you’ll see that it already does basically that – it also has a parameter which, when true, clears the array as well, but will output black to all pixels first.
Are you running into any sort of issue @Stuart_Taylor ?
@marmil no, no issue. Its just one of those things, like spelling. Your write something and look at it, and you know its right, but you still have that feeling…
Thanks @Luminous_Elements after @marmil posted i went to have a look in the source too, because i thought i bet that what its doing under the hood.
The only thing i’ve had to add is a global Bool, to maintain “Blackout” state 