Blinking 3 LED's with one button using mills instead delays

So #2 talks about a different project than the top post, right? That snippet misses lots of essential info so not too much of idea what it's supposed to do.

You need to keep track of various states:

  • the button itself: but only it being pushed, not it being released.
  • the LED: whether it's on or off.
  • the blinks: what sequence it's in (the 1000, 2000 or 3000 ms).

Easiest for the time checking will be to set your check time to the future rather than using an interval. Something like:

if (millis() - nextBlink > 0) {
  // Do the next stage of the blink.
  if (ledState == HIGH) { // assume HIGH = on
    ledState = LOW;
    digitalWrite (ledPin, LOW);
    nextBlink += 1000;
  }
  else { // it was off, switch on for some time.
    ledState = HIGH;
    digitalWrite(ledPin, HIGH);
    switch blinkSequence {
      case 1:
        nextBlink += 1000;
        break;
      case 2:
        nextBlink += 2000;
        break;
      case 3:
        nextBlink += 3000;
        break;
    }
  }
}

The button cycles through the blinkSequence; this code takes care of the various intervals.