New arduino pin number security door lock
code
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,13,0,1,2,3);//Rs-12,E-13,D4-0,D5-1,D6-2,D7-3
#define r1 11
#define r2 10
#define r3 9
#define r4 8
#define c1 7
#define c2 6
#define c3 5
#define c4 4
int val=0;
int v=0;
void setup() {
lcd.begin(16,2);
pinMode(r1,OUTPUT);
pinMode(r2,OUTPUT);
pinMode(r3,OUTPUT);
pinMode(r4,OUTPUT);
pinMode(c1,INPUT_PULLUP);
pinMode(c2,INPUT_PULLUP);
pinMode(c3,INPUT_PULLUP);
pinMode(c4,INPUT_PULLUP);
digitalWrite(r1,1);
digitalWrite(r2,1);
digitalWrite(r3,1);
digitalWrite(r4,1);
pinMode(A5,OUTPUT);
digitalWrite(A5,HIGH);
delay(1000);
digitalWrite(A5,LOW);
delay(100);
digitalWrite(A5,HIGH);
delay(1000);
digitalWrite(A5,LOW);
delay(100);
}
void loop() {
digitalWrite(r1,0);
if(digitalRead(c1)==0){
lcd.print('1');
val+=10010;
}
if(digitalRead(c2)==0){
lcd.print('2');
val+=110;
}
if(digitalRead(c3)==0){
lcd.print('3');
val+=190;
}
if(digitalRead(c4)==0){
// lcd.print('A');
lcd.clear();
lcd.print(" checking");
delay(1000);
lcd.clear();
if(val==450){
//Serial.println(" ");
lcd.clear();
lcd.println(" correct PIN ");
delay(2000);
lcd.setCursor(1,3);
lcd.println(" Welcome ");
delay(2000);
lcd.clear();
digitalWrite(A5,0);
delay(1000);
digitalWrite(A5,1);
digitalWrite(A4,HIGH);
delay(5000);
digitalWrite(A4,LOW);
val=0;
v=0;
}
else{
v++;
lcd.clear();
lcd.println("in correct PIN ");
delay(2000);
lcd.clear();
for(int r=0;r<6;r++){
digitalWrite(A5,HIGH);
delay(100);
digitalWrite(A5,LOW);
delay(100);}
if(v==4){
lcd.clear();
lcd.println("access is blocked") ;
delay(3000);
lcd.clear();
lcd.println("wait two minutes");
val=20000;
delay(20000); }
lcd.clear(); }}
digitalWrite(r1,1);
digitalWrite(r2,0);
if(digitalRead(c1)==0){
lcd.print('4');
val+=12000;}
if(digitalRead(c2)==0){
lcd.print('5');
val+=100;}
if(digitalRead(c3)==0){
lcd.print('6');
val+=106;}
digitalWrite(r2,1);
digitalWrite(r3,0);
if(digitalRead(c1)==0){
lcd.print('7');
val+=101;}
if(digitalRead(c2)==0){
lcd.print('8');
val+=140;}
if(digitalRead(c3)==0){
lcd.print('9');
val+=180;}
if(digitalRead(c4)==0){
lcd.clear();
val=0;}
digitalWrite(r3,1);
digitalWrite(r4,0);
if(digitalRead(c2)==0){
lcd.print('0');
val+=150;}
digitalWrite(r4,1);
delay(220);
}