Move on when button is pressed?

    while (digitalRead(4) == HIGH) {
    for(int whiteLed = 0; wLed < NUM_LEDS; wLed = wLed + 1) {
      leds[wLed] = CRGB::Green;
      FastLED.show();
      delay(200);
      leds[whiteLed] = CRGB::Black;
    }

I was looking for the LED ‘step’ sequence to freeze and ‘move on’ when the 4 button is pressed (4=LOW). Right now it ‘moves on’ but only when the sequence is finished.
Any good ideas how to move on and leave the last LED on immediately when the button is pressed?

An inelegant way might be to read the pin inside the for, and break if it's low?

for(int whiteLed = 0; wLed < NUM_LEDS; wLed = wLed + 1) {

You got two different variables in there…

-jim lee

manor_royal:
An inelegant way might be to read the pin inside the for, and break if it's low?

I don't know why you say it is inelegant. It is perfect :slight_smile: Thank you.