#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int led1= 5;
int led2= 11;
int sw1= 6;
int sw2= 7;
int sw3= 8;
int sw4= 4;
String a;
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(sw1, INPUT);
pinMode(sw2, INPUT);
pinMode(sw3, INPUT);
pinMode(sw4, INPUT);
Serial.begin(9600);
}
void loop()
{
int push1=digitalRead(sw1);
int push2=digitalRead(sw2);
int push3=digitalRead(sw3);
int push4=digitalRead(sw4);
if (push1 == 1)
{
a += "M";
delay(1000);
Serial.print(a);
}
if (push2 ==1)
{
a += "E";
delay(1000);
Serial.print(a);
}
if (push3 == 1)
{
a += "N";
delay(1000);
Serial.print(a);
}
if (push4 ==1)
{
a += "U";
delay((1000));
Serial.print(a);
}
if (a.length() >=5)
{
if (a == "MEENU")
{
digitalWrite(led1, HIGH);
delay(1000);
lcd.setCursor(0,1);
lcd.print("PASSWORD MATCHED");
}
else
{
digitalWrite(led2, HIGH);
delay(1000);
lcd.setCursor(0,0);
lcd.print("INCORRECT PASSWORD");
}
// put your main code here, to run repeatedly:
}
}