This is probably an easy question but I can not seem to be able

This is probably an easy question but I can not seem to be able to get it right at the moment.

I am using the DemoReel100-Sketch which I find very elegant and I am adding some new pattern and testing it out to learn the basic.

I want to add a function that gradually increases the brightness from current brightness to a given value during a given amount of time, and also decrease the brightness in the same way.

I would like to do it in the same way as all the other function in the DemoReel code. Any suggestion?

You might want to look at something like this:

uint8_t mysine = beatsin8( BeatsPerMinute, 0, 255);

and wrap this in a loop:

leds[i] = blend(CRGB::Red, CRGB::Blue, sin8(mysine));

I think you and I are after the same thing! I found some non-FastLED code and hacked/bashed it to get the effect I want. It starts dark, fades up red, holds, fades down, fades up green, holds, fades down, fades up blue, holds, fades down, repeats.

I need to find a better way to do it – it’s VERY klunky right now, but below is the void loop I created for Mark Kriegsman’s Timed Playlist Sketch…

@allanGEE Try To show some quick code, you don’t need a fancy github account.

@Andrew_Tuline Thanks! Have edited my original post to get rid of all that text!

@Andrew_Tuline @allanGEE thanks for the replies, I had already tried the sin functions and got it to work but the code is not nearly as simple or readable as the other functions in the DemoReel code. Mostly since the sin goes up and down and needs if statement to cut at maximum/minimum.
I was mostly wondering if there is a better way to do this that I must have missed, like a sin-function that only goes up or only down? from given value to another.

@Alborz_Sedaghat I still haven’t been able to wrap my head around any sin functions at all. I think – once I have time – I need to run some simple sketches and have it show the values in real time so I can understand what it’s doing.

Best of luck with your project!