this is for CT262 Week 6 at Grantham. I have to write this Arduino sketch that does the following:
A system that requests an input from the user in the form of a username or an ID (i.e. jd626) and then checks to verify that against stored username or ID. The system should display “Please enter your username or ID: ” in the serial monitor when you run the code.
1) If the data entered by the user matches the stored data then the system results in an authorized access (simulating an authorized entry) by echoing “Hello
” in the serial monitor and turning ON the green LED on the circuit.
2) If the data entered does not match the stored data then the system results in unauthorized access (simulating an unauthorized entry) by echoing “Invalid Username” in the serial monitor and turning ON the red LED on the circuit. Make a note that the original prompt will be displayed to repeat the process in the serial monitor.
I have a sketch written but it allows any name access. Please help me to understand what I need to change to make this sketch work properly:
const int RED=11;
const int GREEN=10;
Serial.println(“Please enter your username or ID: “);
login = Serial.readString();
if (login = “james”)
else if (login != “james”)