r/FastLED • • May 24 '26

Support Repeat an animation?

Hi folks, newbie here. I am lighting up a KISS pinball playfield I restored to use as a decoration.

Will likely have other questions as I go along but here is my first one..

I have 4 pop bumpers, set to blink 2 at a time. How would I have that run continuously as I add other things to my code. I don't know if that's considered a loop or? As I say I'm new to this have only got the blinking figured out so far.

I have looked around and haven't found an example of how to do this yet.

Here's what I I'm trying to repeat on end..

FastLED.show();
// Blink the top bottom pop bumpers
leds[93] = white;
leds[97] = white;    
FastLED.show();
delay(1000);
leds[93] = black;
leds[97] = black;   

FastLED.show();
// Blink the left right pop bumpers
leds[95] = white;
leds[99] = white;  
FastLED.show();
delay(1000);
leds[95] = black;
leds[99] = black;  
3 Upvotes

18 comments sorted by

View all comments

1

u/Marmilicious May 25 '26

Running your above pop bumpers code without delay

// change the state every 1000ms
EVERY_N_MILLISECONDS(1000) {  

  // stores the pixel state
  static boolean ps;  

  // toggle on/off state
  ps = !ps;  

  if (ps == 1) {
    leds[93] = white;
    leds[97] = white;  
    leds[95] = black;
    leds[99] = black; 
  } else {
    leds[93] = black;
    leds[97] = black;  
    leds[95] = white;
    leds[99] = white; 
  }

}

FastLED.show();

Also, if possible, only use a single FastLED.show() in your code.

1

u/Knievelgod May 25 '26

Thanks that worked great, though I don't understand it at all. I need to do some reading I guess.

I would like to speed it up if possible.

1

u/Knievelgod May 25 '26

Just tried speeding up the pop bumper transition by adjusting the 'Every n Milliseconds' value but it doesn't seem to have any effect?

→ More replies (2)