Skip to content

Commit cb69d45

Browse files
Add files via upload
1 parent b419c07 commit cb69d45

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
2+
//*LCD INITIALIZATION*//
3+
#include <LiquidCrystal.h>
4+
const int rs=47,rw=46, en=45, d0=44, d1=43, d2=42, d3=41, d4 = 40, d5 = 39, d6 = 38, d7 = 37;
5+
LiquidCrystal lcd(rs, rw,en,d0,d1,d2,d3, d4, d5, d6, d7);
6+
7+
int j=0;
8+
int i=0;
9+
int buzzer=31;
10+
int LED1=22;
11+
12+
//*RFID INITIALIZATION*//
13+
char b[12];
14+
char Rahul[12]={'0','8','0','0','F','0','5','4','B','2','1','E'};
15+
char Reshma[12]={'0','8','0','0','C','7','9','8','0','4','5','3'};
16+
int count=0;
17+
18+
//*MOTOR INITIALIZATION*//
19+
int Motor1=33;
20+
int Motor2=34;
21+
22+
void setup() {
23+
lcd.begin(16,2); //SELECTING LCD COLUMNS & ROWS
24+
Serial.begin(9600);//INITALIZING SERIAL COMMUNICATION
25+
Serial2.begin(9600);//INITALIZING BLUETOOTH SERIAL COMMUNICATION
26+
Serial3.begin(9600); //INITALIZING RFID SERIAL COMMUNICATION
27+
pinMode(Motor1,OUTPUT); //DIFINING MOTOR1 AS OUTPUT DEVICE
28+
pinMode(Motor2,OUTPUT); //DIFINING MOTOR2 AS OUTPUT DEVICE
29+
pinMode(LED1,OUTPUT); //DIFINING LED1 AS OUTPUT DEVICE
30+
pinMode(buzzer,OUTPUT); //DIFINING BUZZER AS OUTPUT DEVICE
31+
digitalWrite(LED1,HIGH); //INITIALIZING LED1 OFF
32+
digitalWrite(Motor1,LOW); //INITIALIZING MOTOR1 OFF
33+
digitalWrite(Motor2,LOW); //INITIALIZING MOTOR2 OFF
34+
Serial.println("CLEARDATA");
35+
Serial.println("LABEL,Time,Date,Student Name,");
36+
Serial.println("RESTTIMER");
37+
while(j!=5){
38+
lcd.noDisplay();
39+
delay(500);
40+
lcd.display();
41+
delay(500);
42+
lcd.print("!! ATTENDANCE !!");
43+
lcd.setCursor(0,1);
44+
lcd.print("! SCAN YOUR CARD !");
45+
j++;
46+
}}
47+
48+
void loop() {
49+
50+
if (Serial3.available()){ //IF RFID TAG IS AVAILABLE TO SCAN
51+
b[count]=Serial3.read(); //SCAN THE TAG AND STORE THE VALUE IN ARRAY 'b'
52+
count++;
53+
}
54+
if(count==12) //IF SCANNED ARRAY VALUE IS OF 12 DIGITS ENTER IN THE LOOP
55+
{
56+
if(strncmp(b,Rahul,12) ==0) //COMPARING STRING BETWWEN STORED AND SCANNED VALUE
57+
{
58+
lcd.clear(); //MAKING LCD CLEAR FOR PRINTING
59+
lcd.write("Access Granted"); //LCD OUTPUT
60+
delay(500);
61+
digitalWrite(LED1,LOW); //LED1 ON
62+
digitalWrite(buzzer,HIGH); //BUZZER ON
63+
delay(500);
64+
digitalWrite(LED1,HIGH); //LED1 OFF
65+
digitalWrite(buzzer,LOW); //BUZZER OFF
66+
Serial.println("DATA,TIME,DATE,Rahul,");
67+
Serial.println(b[count]);
68+
delay(1000);
69+
Serial2.println("RAHUL PRESENT"); //PRINTING OUTPUT ON BLUETOOTH TERMINAL THROUGH BLUETOOTH
70+
lcd.clear();
71+
lcd.write("WELCOME RAHUL");
72+
delay(500);
73+
digitalWrite(Motor1,HIGH); //MOTOR1 ON
74+
delay(1000);
75+
digitalWrite(Motor1,LOW); //MOTOR1 OFF
76+
count=0;}
77+
78+
else if (strncmp(b,Reshma,12)==0) //COMPARING STRING BETWWEN STORED AND SCANNED VALUE
79+
{
80+
lcd.clear(); //MAKING LCD CLEAR FOR PRINTING
81+
lcd.write("Access Granted"); //LCD OUTPUT
82+
delay(500);
83+
digitalWrite(LED1,LOW); //LED1 ON
84+
digitalWrite(buzzer,HIGH); //BUZZER ON
85+
delay(500);
86+
digitalWrite(LED1,HIGH); //LED1 OFF
87+
digitalWrite(buzzer,LOW); //BUZZER OFF
88+
Serial.println("DATA,TIME,DATE,Reshma,");
89+
delay(1000);
90+
Serial2.println("RESHMA PRESENT"); //PRINTING OUTPUT ON BLUETOOTH TERMINAL THROUGH BLUETOOTH
91+
lcd.clear();
92+
lcd.write("WELCOME RESHMA");
93+
digitalWrite(Motor1,HIGH); //MOTOR1 ON
94+
delay(1000);
95+
digitalWrite(Motor1,LOW); //MOTOR1 OFF
96+
count=0;
97+
}else
98+
{lcd.clear();
99+
lcd.write("Access Denied"); //IF TAG READ VALUE IS MISMATCH, PRINT THIS ON LCD
100+
count=0;}
101+
count=0;}} //RESETTING THE COUNT=0 FOR THE NEXT SCAN & STORE

0 commit comments

Comments
 (0)