Here a short video of my actual project.

Here a short video of my actual project. My goal is it to blend between 2 LED arrays controlled with a pushbutton. And if blending isn’t fully finished and the button is released it blends back to the old color without any flickering very fluently. Later you will see the code this works fine. But I have a lot of global memory variables which are calling my blending up or down functions and I want to use this with 5 or more stripes and dimming should be possible at the same time. → with this code is this possible, but I have to copy my functions because of the memory functions, if blending is ready…

But I think this isn’t a good solution. I hope I can get help from you how to improve the structure / architecture to make this with many led stripes in parallel possible and with one good function and less code. I have read something maybe it is an option to make this with OOP? I need some help.Thanks!

/////////////////////////////////////code////////////////////////////////
#include <FastLED.h>

#define NUM_LEDS 7
#define BRIGHTNESS 255

CRGB leds[NUM_LEDS];
CHSV leds_startvalue_chsv[NUM_LEDS];
CHSV leds_chsv [NUM_LEDS];
CHSV leds_nextblend [NUM_LEDS];

#define UPDATES_PER_SECOND 100

bool b_Licht_active=0;
bool b_Licht_up=0;
bool b_Licht_down=0;
bool b_Licht_dimm_fertig=true;
bool b_Licht_last_step = false;
int Licht_Step=0;
bool merker=0;

elapsedMillis Licht_time;

void setup() {
delay( 500 ); // power-up safety delay
pinMode(0, INPUT_PULLUP);
delay( 500 ); // power-up safety delay
attachInterrupt(0,I_BTN,CHANGE); //BTN

FastLED.addLeds<DOTSTAR,13,12, BGR,DATA_RATE_MHZ(14)>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
fill_rainbow(leds_chsv,6,0,30);
//dimming the light
for(int i=0;i<=NUM_LEDS;i++)
{
	leds_chsv[i].value=50;
}
FastLED.setBrightness(  BRIGHTNESS );

}

void loop()
{

// interrupt from button down
if(b_Licht_active && b_Licht_up)
{
	{
		// create the blend color array
		CHSV Test[3];
		fill_rainbow(Test,3,0,10);
		///

		// counter value of blending level
		//light dimm_up(count value,stripe_num,start_led,num_leds,ledarray);
		Licht_Step=Licht_hochdimmen(Licht_Step,0,2,3,Test);
		//Licht_time=0;
	}

}



// interrupt from button up
if(b_Licht_active==true && b_Licht_down)//  runterdimmen
{

	
	{
		Licht_Step=Licht_runterdimmen(Licht_Step,0,2,3);

		//Licht_time=0;

	}


}


// conversion
hsv2rgb_rainbow(leds_chsv,leds,6);
FastLED.show();
FastLED.delay(1000/120); 

}

void I_BTN()
{

b_Licht_active=true;
Licht_Step=0;

if(!digitalRead(0))
{
	b_Licht_up=true;
	b_Licht_down=false;
}
else
{
	b_Licht_up=false;
	b_Licht_down=true;
}

}

// blend up
uint8_t Licht_hochdimmen(uint8_t k, uint8_t i_Stripe_num, uint8_t i_start_led, uint8_t i_num_led, CHSV led_array[])
{

// first blend cycle and last blend complete
if(k==0 && b_Licht_dimm_fertig)
{
	// copy startvalue
	memcpy8(leds_startvalue_chsv+i_start_led,leds_chsv+i_start_led,(i_num_led*3)); // Dest, Source, Bytes 


	memcpy8(leds_nextblend+i_start_led,leds_chsv+i_start_led,(i_num_led*3)); // Dest, Source, Bytes


}
if(k==0 &&!b_Licht_dimm_fertig) // blend down wasnt complete --> modified start value
{
	memcpy8(leds_nextblend+i_start_led,leds_chsv+i_start_led,(i_num_led*3)); // Dest, Source, Bytes
}

b_Licht_dimm_fertig=false; // Information schreiben, dass aktuell gedimt wird, damit nicht das array kopiert wird // blend active --> not copy the array

// blending of colors
for(uint8_t i=0;i<i_num_led;i++)
	{
		leds_chsv[i+i_start_led]=blend(leds_nextblend[i+i_start_led],led_array[i],k, SHORTEST_HUES);
		
	}





if(k >= 254)
{
	k=0;

	b_Licht_dimm_fertig=true;
	b_Licht_up=false;
}
else
{
	k=k+2;
}


// return counter value
return k;

}

// blend down
uint8_t Licht_runterdimmen(uint8_t k, uint8_t i_Stripe_num, uint8_t i_start_led, uint8_t i_num_led)
{

if(k==0)
{
	memcpy8(leds_nextblend+i_start_led,leds_chsv+i_start_led,(i_num_led*3));



}
b_Licht_dimm_fertig =false;

for(uint8_t i=0;i<i_num_led;i++)
{
	leds_chsv[i+i_start_led]=blend(leds_nextblend[i+i_start_led],leds_startvalue_chsv[i+i_start_led],k, SHORTEST_HUES);

}




if(k >= 254)
{
	k=0;

	b_Licht_active=false;
	b_Licht_dimm_fertig=true;
	b_Licht_down=0;

}
else
{
	k=k+2;
}


return k;

}

no one any idea?

I don’t really understand your code, but if you’re just doing brightness or hue changes, why not use a simple counter?

float brightness = 64; //max 256

if (button = ON){
if (brightness < 256){
brightness++;
}
}
else {
if (brightness > 64){
brightness–;
}
}

Thanks for you help Kevin. But it isn’t so easy. Maybe I will explain it with my project tomorrow a little bit more detailed.