Another possible approach:
#include <FastLED.h>
#define NUM_STRIPS 3
#define NUM_LEDS 8
#define COLOR_ORDER GRB
#define LED_TYPE WS2812B
CRGB leds[NUM_STRIPS][NUM_LEDS];
//Pin locations for LED strips
const int lowerLEDs = 5;
const int middleLEDs = 6;
const int upperLEDs = 7;
#define NUM_PATTERNS 3
void Pattern1( void ); //pattern prototypes
void Pattern2( void );
void Pattern3( void );
typedef void(*pPatternFunc_t)(void);
//array of pointers to the pattern functions
pPatternFunc_t
pPatterns[NUM_PATTERNS] =
{
&Pattern1,
&Pattern2,
&Pattern3
};
const uint8_t
pinSwitch = 2, //pattern change switch input
pinLED = LED_BUILTIN; //for demo purposes
uint8_t
idxPattern = 0,
lastSw;
uint32_t
tNow,
tSwitch = 0ul;
void setup()
{
delay(3000); //For recovery
//Add led strip arrays
FastLED.addLeds<LED_TYPE, lowerLEDs, COLOR_ORDER>(leds[0], NUM_LEDS);
FastLED.addLeds<LED_TYPE, middleLEDs, COLOR_ORDER>(leds[1], NUM_LEDS);
FastLED.addLeds<LED_TYPE, upperLEDs, COLOR_ORDER>(leds[2], NUM_LEDS);
pinMode( pinSwitch, INPUT_PULLUP );
lastSw = digitalRead( pinSwitch );
pinMode( pinLED, OUTPUT );
}//setup
void loop()
{
if( ReadSw() )
{
//clean up existing pattern
FastLED.clear();
FastLED.show();
digitalWrite( pinLED, LOW );
//bump pattern being shown on button press
idxPattern++;
if( idxPattern == NUM_PATTERNS )
idxPattern = 0;
}//if
//process current pattern every pass of loop()
pPatterns[idxPattern]();
}//loop
bool ReadSw( void )
{
//update the switch every 50mS
tNow = millis();
if( (tNow - tSwitch) < 50ul )
return false;
tSwitch = tNow;
//return true if switch input seen to go from not-pressed to pressed
uint8_t nowSw = digitalRead( pinSwitch );
if( nowSw != lastSw )
{
lastSw = nowSw;
if( nowSw == LOW )
return true;
}//if
return false;
}//ReadSw
void Pattern1( void )
{
static uint32_t
tPattern = 0ul;
static uint8_t
strip=0,
led=0;
//patterns need to be non-blocking
tNow = millis();
//update this pattern every 100mS
if( (tNow - tPattern) >= 100ul )
{
tPattern = tNow;
leds[strip][led] = CRGB::Red;
FastLED.show();
leds[strip][led] = CRGB::Black;
//this part replaces the for-loops of the original code
led++;
if( led == NUM_LEDS )
{
led = 0;
strip++;
if( strip == NUM_STRIPS )
strip = 0;
}//if
}//if
}//Pattern1
void Pattern2( void )
{
static uint32_t
tBlink;
//filler code to demonstrate change of patterns
//toggle LED every 500mS
tNow = millis();
if( (tNow - tBlink) >= 500ul )
{
tBlink = tNow;
digitalWrite( pinLED, digitalRead( pinLED ) ^ HIGH );
}//if
}//Pattern2
void Pattern3( void )
{
static uint32_t
tBlink;
//filler code to demonstrate change of patterns
//toggle LED every 150mS
tNow = millis();
if( (tNow - tBlink) >= 150ul )
{
tBlink = tNow;
digitalWrite( pinLED, digitalRead( pinLED ) ^ HIGH );
}//if
}//Pattern3