I have tried various ways of going from minimum brightness to full brightness I have also searched on the net and found snippets, but not a full working example.
As I am trying to keep this simple I include my fade down code. Which works.
On the internet I have found someone said that you can fade up using scale8, but I am unsure of where to put in the code I have and I assume an adjustment to the count to fade up ?
Thanks for any help I have spent at least 5 hours on this already trying various code.
One of the big problems in using a library is that you are denied the opportunity to learn. You have to learn what all the functions and methods do but that learning is not transferable knowledge. To fade down you need to reduce the red, green and blue values in the display buffer. But you seem to use a method maximizeBrightness , so read the documentation to see if their is a minimizeBrightness method or try a negitave value in the method you use.
Eventually I did find the correct way of doing this.
First in my code, you must have a number in 'FastLED_fade_counter' in my case I use 255 as this fades from maximum brightness, and then in a separate part of code not shown here I check if the counter has reached '0' so all LEDS are OFF.
Either of the above numbers can be changed to suit your project.
Hope this helps someone in the future !
void Scene_fade_down ()
{
for ( int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB::Magenta; // Can be any colour.
leds[i].maximizeBrightness(FastLED_fade_counter); // 'FastLED_fade_counter' How low we want to fade down to 0 = maximum.
}
FastLED.show();
FastLED_fade_counter -- ; // Decrement
}
Sorry i have been doing a lot of coding and forgot that it was fade up.
Here's the code
void Scene_01_fade_up ()
{
for ( int i = 0; i < NUM_LEDS; i++ )
{
leds[i] = CRGB::Orange; // Can be any colour
leds[i].maximizeBrightness(FastLED_fade_counter); // 'FastLED_fade_counter' How high we want to fade up to 255 = maximum.
}
FastLED.show();
FastLED_fade_counter ++ ; // Increment
}