#include <LiquidCrystal.h> // include the LCD library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // initialize the LCD pins
int password = 679874; // set the password
void setup() {
lcd.begin(16, 2); // set the LCD size
lcd.print("Enter Password:"); // display prompt on LCD
}
void loop() {
int input = 0; // initialize input variable
while (input != password) { // loop until correct password is entered
if (Serial.available() > 0) { // check for input from serial monitor
input = Serial.parseInt(); // read input as integer
lcd.setCursor(0, 1); // set cursor to second line of LCD
lcd.print(" "); // clear previous input
lcd.setCursor(0, 1); // set cursor back to second line
lcd.print(input); // display input on LCD
}
}
lcd.clear(); // clear LCD
lcd.print("Access Granted!"); // display success message
// add code here to unlock the security system
}
// Code sourced from Arduino website for LCD library: https://www.arduino.cc/en/Reference/LiquidCrystal