matrix keypad keycode aka password.

Ok so part of my project is to hook up a matrix keypad to my arduino. The keypad has 7 terminal pins. I mapped it out already. So what I would like to accomplish is if I hit a certain number combo(password), the arduino sends 5v on a specified pin. How would I accomplish this? Wait for input with if statements? Like if digitalRead(7, input) == HIGH) then blah blah blah. Any help is appreciated! Thanks

Also, I would like to incorporate a green led if password is correct and a red if password is wrong.

Ok so part of my project is to hook up a matrix keypad to my arduino.

Are you using the Keypad library? If not, why not?

So what I would like to accomplish is if I hit a certain number combo(password), the arduino sends 5v on a specified pin.

Easy.

How would I accomplish this?

Use digitalWrite() to set the OUTPUT pin HIGH.

Wait for input with if statements?

You wait with while statement, not if statements.

Also, I would like to incorporate a green led if password is correct and a red if password is wrong.

Sorry. You can only use blue and yellow.

PaulS: You wait with while statement, not if statements.

I disagree with this (seriously). The best way to wait, is to decide what conditions need to be true for you to continue. Then in your loop(), you don't fall into that code until those conditions are true. Let loop() run as fast as it can, and drive your application like a state machine.

Got it.

I disagree with this (seriously). The best way to wait, is to decide what conditions need to be true for you to continue. Then in your loop(), you don't fall into that code until those conditions are true. Let loop() run as fast as it can, and drive your application like a state machine.

Well, sure, but if you want to wait, it's with a while loop, not an if statement.

I agree, though, that it is nearly never necessary to wait, in the sense of doing nothing until a trigger condition is true. One can almost always do something else, even if that something else is just looking for something to do, until the trigger event occurs.

All I was suggesting was to work on one issue at a time. Connect the keypad. Write some code to read the keys pressed. Write some code to collect the key data in an array. Write some code to compare that data to a known value. When you can get a password, use ctrl-A, ctrl-X to delete that code. You know that that hardware works.

Now, write some code to read the key presses, whenever they occur, and do something with the data when it makes sense to.

When reading, for instance, one reads each character at a time, and forms words when it makes sense to, as in when a space or other punctuation occurs.

OP, you need to decide what that trigger will be. Perhaps the # or star key, if your keypad has them (with the other being the oops, back up one character key).