This is a RFID based attendance system. The current program is only for two users but can be easily scaled for more users. Apart from FRDM-K64F board, we have MFRC522, Nokia 5110 LCD and SD card as external hardware. Each time a legitimate card is flashed the name of the person will be displayed on the LCD and his information will be stored in SD card if it's already not there. I have used existing libraries for all the harware. Here is the list. MFRC522 - By Martin Olejar SDFileSystem - By Andrew Lindsay NOKIA_5110 - By Chris Yan.
Dependencies: MFRC522 NOKIA_5110 SDFileSystem mbed
Fork of FTF2014_lab4 by
Diff: main.cpp
- Revision:
- 4:6ba6c4be9dde
- Parent:
- 3:ade6c26d1b90
- Child:
- 5:9f7e1200059e
--- a/main.cpp Sat May 02 18:19:18 2015 +0000 +++ b/main.cpp Sat May 02 19:29:57 2015 +0000 @@ -82,9 +82,10 @@ printf("Card UID: "); for (uint8_t i = 0; i < RfChip.uid.size; i++) { - printf(" %X02 ", RfChip.uid.uidByte[i]); + printf("%X02", RfChip.uid.uidByte[i]); user[i]=RfChip.uid.uidByte[i]; } + printf("\n"); if(flag) { found=0; @@ -92,7 +93,7 @@ { for (uint8_t j = 0; j < RfChip.uid.size; j++) { - if(userlist[i][j]==user[i]) + if(userlist[i][j]==user[j]) { found++; printf("Found=%d\n",found); @@ -110,37 +111,46 @@ //userlist[i][j]==user[i]; for (uint8_t j = 0; j < RfChip.uid.size; j++) { - userlist[usercount][j]==user[j]; - usercount++; + userlist[usercount][j]=user[j]; } - // printf("\n user added"); + + usercount++; + printf("\n user added"); } } else { + printf("inside the else\n"); for (uint8_t i = 0; i < RfChip.uid.size; i++) //make it size of user { - userlist[m][i]==user[i]; - usercount++; + userlist[0][i]=user[i]; + printf("%i %X02 \n",i, userlist[0][i]); //set some flag to not write name to sd card or array } - // printf("\n user added"); + usercount++; + printf("First user added\n"); + flag=1; } - flag=1; - found=0; + + + + + sprintf(abhishektemp,"%X02%X02%X02%X02",user[0],user[1],user[2],user[3]); + printf("Abitemp is %s",abhishektemp); + for(uint8_t i = 0; i < RfChip.uid.size; i++) { abhishektemp[i]=user[i]; - } -if(strcmp(abhishektemp, abhishek)) + } +if(strcmp(abhishektemp, abhishek)==0) { printf("\n found abhishek"); lcd.printString("ABHISHEK",0,0); continue; } -else if(strcmp(abhishektemp,sam)) +else if(strcmp(abhishektemp,sam)==0) { printf("\n found sam"); lcd.printString("SAM",0,0); @@ -158,6 +168,7 @@ printf("\n PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType)); wait_ms(100); + printf("\nWriting data to the sd card \n"); fp = fopen("/sd/attendance.txt", "w"); if (fp == NULL)