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:
- 7:caeacf521320
- Parent:
- 6:bc2ca526022f
- Child:
- 8:ea7d0c9a35c4
--- a/main.cpp Sat May 02 21:42:05 2015 +0000 +++ b/main.cpp Sun May 03 15:40:55 2015 +0000 @@ -2,7 +2,8 @@ #include "SDFileSystem.h" #include "MFRC522.h" #include <stdio.h> -#include "N5110.h" +#include "NOKIA_5110.h" + // FRDM-K64F (Freescale) Pin for MFRC522 reset #define MF_RESET PTD0 FILE *fp; @@ -11,11 +12,6 @@ //Serial connection to PC for output Serial pc(USBTX, USBRX); // serial comm on the FRDM board -//Serial uart(PTC17, PTC16); - -// VCC,SCE,RST,D/C,MOSI,SCLK,LED -//N5110 lcd(PTB2, PTC12, PTD0, PTB3, PTD6, PTD5, PTC12); -N5110 lcd(PTB2, PTC12, PTD0, PTB3, PTD6, PTD5, PTA0); //MFRC522 RfChip (SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, MF_RESET); MFRC522 RfChip (PTD2, PTD3, PTD1, PTE25, PTD0); @@ -41,8 +37,21 @@ pc.printf("Initializing \n"); //wait(2); - // initialise display - lcd.init(); + LcdPins myPins; + myPins.sce = PTC12; + myPins.rst = PTC4; + myPins.dc = PTB3; + myPins.mosi = PTD6; + myPins.miso = NC; + myPins.sclk = PTD5; + + NokiaLcd myLcd( myPins ); + + // Start the LCD + myLcd.InitLcd(); + myLcd.DrawString("HELLO"); + wait( 5 ); + myLcd.ShutdownLcd(); // Init. RC522 Chip RfChip.PCD_Init(); @@ -65,7 +74,7 @@ { RfChip.PCD_Init(); wait_ms(300); - continue; + // continue; } // Select one of the cards @@ -77,8 +86,6 @@ LedGreen = 0; - - // Print Card UID printf("Card UID: "); for (uint8_t i = 0; i < RfChip.uid.size; i++) @@ -99,7 +106,12 @@ if (flagAbi==1) { printf("Already logged in!\n"); - lcd.printString("Abichek",0,0); + + myLcd.InitLcd(); + myLcd.DrawString("ABHISHEK"); + wait( 5 ); + myLcd.ShutdownLcd(); + } else if (flagAbi==0) { @@ -116,7 +128,11 @@ fclose(fp); } flagAbi=1; - lcd.printString("ABHISHEK",0,0); + + myLcd.InitLcd(); + myLcd.DrawString("ABHISHEK"); + wait( 5 ); + myLcd.ShutdownLcd(); } } else if(strcmp(abhishektemp,sam)==0) @@ -125,7 +141,12 @@ if (flagSam==1) { printf("Already logged in!\n"); - lcd.printString("Sam",0,0); + + myLcd.InitLcd(); + myLcd.DrawString("SAM"); + wait( 5 ); + myLcd.ShutdownLcd(); + } else if (flagSam==0) { @@ -143,7 +164,11 @@ } flagSam=1; printf("FlagSam=%i\n",flagSam); - lcd.printString("Sam",0,0); + + myLcd.InitLcd(); + myLcd.DrawString("SAM"); + wait( 5 ); + myLcd.ShutdownLcd(); }