For a project we need to control a motor using a passcode. Once you put in the right passcode using pushbuttons the motor will work. But how do you make the serial print read the data as a passcode and not number by number.(char?arrays?strings?)
Thank you!
(if you have any other ideas feel free to comment)
More info please. If you're using pushbuttons to enter the passcode why do you need to read serial?
Apparently that's the only way the arduino will be able to understand the passcode. I'm not sure if you think of anything else let me know.
Try using arrays with if statements, if the first variable of the array and all the others are equal to the ones from the password, then it will print a message
it should look sort of like this:
if(guess[0] == password[0] && guess[1] == password[1] && guess[2] == password[2]){
Serial.println("password is correct");
} else {
Serial.println("password is incorrect");
}
also our project consists of building a safe and when you enter a four digit code (using 4 pushbuttons) as well as touching a PIR motion sensor the door will open, using a servomoto and an LED light will turn green, if you enter the wrong code or don't put your hand over the motion sensor, the door stays closed and another LED light turns red.
Our project consists of building a safe and when you enter a four digit code (using 4 pushbuttons) as well as touching a PIR motion sensor the door will open, using a servomoto and an LED light will turn green, if you enter the wrong code or don't put your hand over the motion sensor, the door stays closed and another LED light turns red.
Any ideas on the coding? Especially for how to code a passcode
how do you program a four digit passcode to work on arduino? Thank you
See:
@mayajade, stop cross-posting. Threads merged.