Hi, I have tried various ways of going from minimum brightness to full brightness

Hi,

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 ?
https://github.com/FastLED/FastLED/issues/238]https://github.com/FastLED/FastLED/issues/238

Thanks for any help I have spent at least 5 hours on this already trying various code.

Any help please.

#include “FastLED.h”
#define NUM_LEDS 48
#define DATA_PIN 6
CRGB leds[NUM_LEDS];

void setup()
{

FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);

leds[0] = CRGB::MediumSpringGreen;
leds[1] = CRGB::Purple;
leds[2].red = 250; leds[2].green = 100; leds[2].blue = 10;

FastLED.show();

for(int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::Purple;
leds[i].maximizeBrightness(2);
FastLED.show();
}
delay(2000);
}

void loop()
{

fadeall();

}

void fadeall()

  { for(int i = 0; i < NUM_LEDS; i++)

    leds[i].maximizeBrightness(250) ;
    FastLED.show();
    delay(100);

  }

Sometimes it’s easier to use HSV and then you can vary the value of V to fade up and down. Here’s an example:

Small tip to save typing… instead of:
leds[2].red = 250; leds[2].green = 100; leds[2].blue = 10;

you could set that same color like:
leds[2] = CRGB(250,100,10);

And if using HSV, it might be close to:
leds[2] = CHSV(15,245,130);

Also, when sharing programs, please use http://gist.github.com as it will make sure the code can be displayed correctly on all devices, and line numbers can be referenced for discussion.

@Gaz_Baz - If you are trying to fade up and down, you might want to look at @Stuart_Taylor 's breathe sketch at:

https://gist.github.com/hsiboy/4eae11073e9d5b21eae3

I used a modified version of it in my Halloween sketch post.

Here’s another idea, using fadeLightBy for fading up and down.

Hi,

Thanks guys for all your help, I will look at all the examples.

After another 5 hours I did get it to work, but I’m sure it can be done better. But in that time I did understand more how FastLED works, so it was a valuable lesson !

And I have noted that the code should be on Github. but this is the first time on FastLED groups.

Thanks all

Gaz