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 Freescale

main.cpp

Committer:
Kojto
Date:
2014-04-03
Revision:
0:a83db87be46c
Child:
3:ade6c26d1b90

File content as of revision 0:a83db87be46c:

#include "mbed.h"
#include "SDFileSystem.h"

SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // MOSI, MISO, SCK, CS
Serial pc(USBTX, USBRX);
FILE *fp;
char buffer[1024];

int main() {
    pc.printf("Initializing \n");
    wait(2);

    fp = fopen("/sd/hello.txt", "r");
    if (fp != NULL) {
        fclose(fp);
        remove("/sd/hello.txt");
        pc.printf("Remove an existing file with the same name \n");
    }

    printf("\nWriting data to the sd card \n");
    fp = fopen("/sd/hello.txt", "w");
    if (fp == NULL) {
        pc.printf("Unable to write the file \n");
    } else {
        fprintf(fp, "mbed SDCard application!");
        fclose(fp);
        pc.printf("File successfully written! \n");
    }

    printf("\nReading data from the SD card. \n");
    fp = fopen("/sd/hello.txt", "r");
    if (fp != NULL) {
        int size = fread(buffer, sizeof(char), 1024, fp);
        printf("Number of data read: %d, text from hello.txt file: %s \n", size, buffer);
        fclose(fp);
    }
    printf("End of Lab 4. \n");
}