Lighting up an LED after entering a "password"

.

Putting the password in an array of chars would be a good start. Start with an array index variable set to zero.
Then, as a character is received it can be compared to the character at the current position in the array and if correct the corresponding LED is turned on and the index to the array incremented. Once the index equals 4 (see below) turn on the fifth LED. If the wrong character is received at any time turn off all the LEDs and set the index back to zero and start again.

The value of the index to a 4 element array will be from 0 to 3, hence the test for the index reaching 4 indicating success. Do not try to retrieve or test element 4 of the array as it does not exist.

I'm sorry but I just began programming in Arduino so I don't really know how to do any of that.

The serial input basics thread will show how to read a string of characters, from the serial monitor, into a character array that you can then operate on.

And here are some functions that you can use to compare the input string to your password.

Masqqq:
I'm sorry but I just began programming in Arduino so I don't really know how to do any of that.

No problem, you have to start somewhere. Do some research on arrays, they are very useful.

To get you started upload this program to your Arduino. Note that it is intended to illustrate many of the things that I suggested you do. It does NOT do what you described but might help you understand arrays

char password[] = {"ABCD"};  //an array of 4 chars (0 to 3)
byte index = 0;  //index to the current chracter

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  Serial.print("index : ");
  Serial.print(index);    //current value of index
  Serial.print( "  the letter at that position : ");
  Serial.println(password[index]);  //print the current letter
  delay(1000);  //wait a bit to slow things down in this demo
  index++;  //increment the index
  if (index == 4)  //if we have gone past the last letter
  {
    Serial.println("All done\n\n");  //print a message
    delay(2000);  //wait a while in this demo
    index = 0;    //put the index back to the start
    return;    //start the loop() function again
  }
}

Thank you.

What I need though is when I type 'A' the first led lights up, when I type 'B' the second led lights up and so on, and when I type A B C D separately in that order the 5th led lights up and I can't seem to find a way.

Masqqq:
What I need though is when I type 'A' the first led lights up, when I type 'B' the second led lights up and so on, and when I type A B C D separately in that order the 5th led lights up and I can't seem to find a way.

I know what you want. The program I posted was to help you understand the techniques needed to do what you want but I see from your other thread Help with making a LED light up with a specific password - Programming Questions - Arduino Forum that you want someone to write it for you but I will not be doing that.

@Masqqq will be enjoying a few days away from the forum.

Thread closed