Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ID12RFID ID12RFID_HelloWorld TextLCD mbed
Fork of ID12RFID_HelloWorld by
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 00004 Serial rx(NC, PTA1); // uart rx 00005 Serial pc(USBTX, USBRX); 00006 TextLCD lcd(PTA13, PTD5, PTD0, PTD1, PTD2, PTD3, TextLCD::LCD16x2); // RS, E, D4-D7 00007 00008 00009 int count = 0; 00010 int input[12]; 00011 bool flag = 0; 00012 char a[12]= "1518"; 00013 char b[12]= "151F"; 00014 00015 char d[12]="\0"; 00016 int i=0; 00017 int k; 00018 int numa=0; 00019 int numb=0; 00020 int numc=0; 00021 00022 int main() 00023 { 00024 pc.printf("Welcome to RFID Access\n"); 00025 lcd.locate(0,0); 00026 lcd.printf("RF ID:"); 00027 00028 rx.baud(9600); 00029 00030 while(1) 00031 { 00032 /* if (rx.readable()) 00033 { 00034 pc.printf("%02x\n", rx.getc()); 00035 } 00036 */ 00037 00038 if(rx.readable()) 00039 { 00040 count = 0; 00041 while(rx.readable() && count < 12) 00042 { 00043 input[count] = rx.getc(); 00044 pc.printf("%d %c\n", count, input[count]); 00045 if(input[count]==a[i]) 00046 { 00047 d[i]=a[i]; 00048 goto inc; 00049 } 00050 else if(input[count]==b[i]) 00051 { 00052 d[i]=a[i]; 00053 goto inc; 00054 } 00055 00056 else 00057 { 00058 pc.printf("not valid/n"); 00059 exit(0); 00060 } 00061 lcd.locate(count,1); 00062 lcd.putc(input[count]); 00063 00064 00065 inc: count++; 00066 if(count==12) 00067 { 00068 k=strcmp(a,d); 00069 if(k==0) 00070 { 00071 numa=numa+1; 00072 pc.printf("Attendance taken\n"); 00073 pc.printf("%d",numa); 00074 } 00075 k=strcmp(b,d); 00076 if(k==0) 00077 { 00078 numb=numb+1; 00079 lcd.printf("Attendance taken\n"); 00080 pc.printf("%d",numb); 00081 } 00082 } 00083 } 00084 } 00085 } 00086 00087 }
Generated on Fri Jul 22 2022 06:31:15 by
1.7.2
