LED to flash for 3000 millis when button pressed

I think this is what you want

see notes on wiring button.

quick press of button will make the led flash for 3 seconds at 250ms intervals

(easy to test if you change led to pin 13 and use the onboard led)

//one side of button connected to arduino pin 2
//other side of button connected to gnd pin of arduino


const int buttonPin = 2;
const int ledPin =  5;
unsigned long previousMillis1 = 0;
unsigned long previousMillis2 = 0;
unsigned long interval1 = 250;
unsigned long interval2 = 3000;
byte requestFlash = 0;
byte button=0;

void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP);
}

void loop() {
  button = digitalRead(buttonPin);
  unsigned long currentMillis = millis();

  if (button == LOW) {
    requestFlash = 1;
    previousMillis2 = currentMillis;
  }

  if ((currentMillis - previousMillis1 >= 250) && (requestFlash == 1)) {
    digitalWrite(ledPin, !digitalRead(ledPin));
    previousMillis1 = currentMillis;
  }
  if ((currentMillis - previousMillis2 >= interval2) && (requestFlash == 1)) {
    requestFlash = 0;
    digitalWrite(ledPin, LOW);
  }
}