IM TRYING TO HAVE THE SECOND LED TO HAVE A DELAY AND TURN OF AND TURN ON LED 3

int buttonPin = 8;

int fi = 2; int se = 13; int th = 3;

int buttonPushCounter = 0; int buttonState = 0; int lastButtonState = 0;

void setup() { Serial.begin(9600); pinMode(buttonPin, INPUT); pinMode(fi, OUTPUT); pinMode(se, OUTPUT); pinMode(th, OUTPUT);

digitalWrite(fi, HIGH); digitalWrite(se, HIGH); digitalWrite(th, HIGH); delay(300); digitalWrite(fi, LOW); digitalWrite(se, LOW); digitalWrite(th, LOW); }

void loop() { digitalWrite(fi, HIGH); // read the pushbutton input pin: buttonState = digitalRead(buttonPin);

// compare the buttonState to its previous state if (buttonState != lastButtonState) { // if the state has changed, increment the counter if (buttonState == HIGH) { // if the current state is HIGH then the button // wend from off to on: buttonPushCounter++; if(buttonPushCounter == 9){ buttonPushCounter = 2;} Serial.println("on"); Serial.print("number of button pushes: "); Serial.println(buttonPushCounter); } else { // if the current state is LOW then the button // went from on to off: Serial.println("off"); } } // save the current state as the last state, //for next time through the loop lastButtonState = buttonState; switch(buttonPushCounter) {

{

case 1: digitalWrite(fi, LOW); digitalWrite(se, HIGH); delay(500); digitalWrite(se, LOW); digitalWrite(th, LOW);

} } Serial.println(buttonState); }

Please edit your post and add code tags around your code
Type
** **[code]** **
before the code
Type
** **[/code]** **
after the code

Please rephrase your question; you have three LEDs. What needs to happen when you push the button. And what does your code currently do when you push the button?

so I have three LED and one PUSHBUTTON LED #1 is HIGH BOTTON PRESS LED #1 should turn OFF and LED #2 should come on then LED #2 should have a delay of 1000 turn off and the LED #3 should come on

int buttonPin = 8;

int fi = 2;
int se = 13;
int th = 3;

int buttonPushCounter = 0;   
int buttonState = 0;         
int lastButtonState = 0;    

void setup()
{
  Serial.begin(9600);
  pinMode(buttonPin, INPUT);
  pinMode(fi, OUTPUT);
  pinMode(se, OUTPUT);
  pinMode(th, OUTPUT);
  
  digitalWrite(fi, HIGH);
  digitalWrite(se, HIGH);
  digitalWrite(th, HIGH);
  delay(300);
  digitalWrite(fi, LOW);
  digitalWrite(se, LOW);
  digitalWrite(th, LOW);
}

void loop()
{
   digitalWrite(fi, HIGH); // Door fully close.

  buttonState = digitalRead(buttonPin);

  
  if (buttonState != lastButtonState) {
    
    if (buttonState == HIGH) {
      
      buttonPushCounter++;
      if(buttonPushCounter == 3){ buttonPushCounter = 1;}
      Serial.println("off");
      Serial.print("number of button pushes:  ");
      Serial.println(buttonPushCounter);
    } 
    else {
     
      Serial.println("on"); 
    }
  }
  
  lastButtonState = buttonState;
  switch(buttonPushCounter)
  {

  
  {
    
    case 1:
      digitalWrite(fi, HIGH);
      digitalWrite(se, LOW);
      digitalWrite(th, LOW);
      break;
    case 2:
      digitalWrite(fi, LOW);
      digitalWrite(se, HIGH);
      delay(500);
      digitalWrite(se, LOW);
      digitalWrite(th, LOW);
      break;
    case 3:
      digitalWrite(fi, LOW);
      digitalWrite(se, LOW);
      digitalWrite(th, HIGH);
      break;
   
  }
  }
  Serial.println(buttonState);

}

You have an extra set of brackets in the switch statement.

Have a look at the demo Several Things at a Time which illustrates the use of millis() to manage timing without blocking.

...R