New to arduino - 4 button in correct order to display on LCD

Hello,

I just recently learned of Arduino and I want to tackle a project. That being said, I've read the basics and am a novice coder but I want to dive into this. I am trying to do a few things.

4 buttons need to be input in the proper sequence to trigger an event - display a 4 digit number on LCD
If the sequence is input incorrect trigger a different event - display on the LCD a different message

With each button press that is correct I want an LED to stay lit
If an incorrect button is pushed LED's turn off

I want the code entering process to reset itself if nothing happens for 10 seconds

Lastly I want the display to shut off after 1 minute

So far here is what I have for code, this is for 1 button working it probably isnt even simplified the best way possible, layout to follow........

Using an ELEGOO UNO R3

int ledPin = 5;
int switchPin = 2;
boolean lastButton = LOW;
boolean ledOn = false;
boolean currentButton = LOW;

// put your setup code here, to run once:

void setup()
{

//initialize pins as outputs
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
}

boolean debounce(boolean last)
{
boolean current = digitalRead(switchPin);
if (last != current)
{
delay(5);
current = digitalRead(switchPin);
}
return current;
}
// put your main code here, to run repeatedly:
void loop()
{
currentButton = debounce(lastButton);
if (lastButton == LOW && currentButton == HIGH)
{
ledOn = !ledOn;
//!inverts the last call so if it was true now false
}
lastButton = currentButton;
digitalWrite(ledPin, ledOn);
}

Please read the forum sticky post to find out how to post your code correctly, and edit your post above to fix it.

Also look into the finite state machine, as that's what you need.

Basically, if the button order is 1, 2, 3, 4, you'd get something like this:

unsigned int lastPressed = 0;

void loop() {
  if (digitalRead(button1) == LOW) { // You probably need to debounce your buttons or it's registered a second time as false press - you may simply use lastPressed for this and ignore presses for 25 ms or so.
    if (programState == 0) programState = 1 // Next step.
    else programState = 0; // wrong button; back to zero.
    lastPressed = millis(); // record when we had a button pressed.
  }
  if (digitalRead(button2) == LOW) {
    if (programState == 1) programState = 2 // Next step.
    else programState = 0; // wrong button; back to zero.
    lastPressed = millis(); // record when we had a button pressed.
  }
  // Same for the other buttons.

  if (millis() - lastPressed) > 10000 programSate = 0; // reset after 10 seconds of no button presses.


  // Set LEDs based on the stage you're in.

}