LCD display, Teraterm display
Dependencies: ID12RFID ID12RFID_HelloWorld TextLCD mbed
Fork of ID12RFID_HelloWorld by
Revision 3:61e6bd867047, committed 2015-07-15
- Comitter:
- nmoorthy2001
- Date:
- Wed Jul 15 09:21:34 2015 +0000
- Parent:
- 2:53965de58fda
- Commit message:
- RFID reader with 16x2 LCD, TeraTerm
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 53965de58fda -r 61e6bd867047 main.cpp --- a/main.cpp Sat May 09 09:29:16 2015 +0000 +++ b/main.cpp Wed Jul 15 09:21:34 2015 +0000 @@ -1,16 +1,23 @@ -// Program for reading and matching RFID tags - #include "mbed.h" #include "TextLCD.h" - + Serial rx(NC, PTA1); // uart rx Serial pc(USBTX, USBRX); TextLCD lcd(PTA13, PTD5, PTD0, PTD1, PTD2, PTD3, TextLCD::LCD16x2); // RS, E, D4-D7 - - + + int count = 0; int input[12]; bool flag = 0; +char a[12]= "1518"; +char b[12]= "151F"; + +char d[12]="\0"; +int i=0; +int k; +int numa=0; +int numb=0; +int numc=0; int main() { @@ -19,7 +26,7 @@ lcd.printf("RF ID:"); rx.baud(9600); - + while(1) { /* if (rx.readable()) @@ -27,7 +34,7 @@ pc.printf("%02x\n", rx.getc()); } */ - + if(rx.readable()) { count = 0; @@ -35,11 +42,46 @@ { input[count] = rx.getc(); pc.printf("%d %c\n", count, input[count]); + if(input[count]==a[i]) + { + d[i]=a[i]; + goto inc; + } + else if(input[count]==b[i]) + { + d[i]=a[i]; + goto inc; + } + + else + { + pc.printf("not valid/n"); + exit(0); + } lcd.locate(count,1); lcd.putc(input[count]); - count++; + + + inc: count++; + if(count==12) + { + k=strcmp(a,d); + if(k==0) + { + numa=numa+1; + pc.printf("Attendance taken\n"); + pc.printf("%d",numa); + } + k=strcmp(b,d); + if(k==0) + { + numb=numb+1; + lcd.printf("Attendance taken\n"); + pc.printf("%d",numb); + } + } } } } - -} + +} \ No newline at end of file