It is a door opener with mbed and Felica(RFID).

Dependencies:   mbed Servo SDFileSystem

main.cpp

Committer:
ryought
Date:
2011-12-23
Revision:
2:51b3c5ba45f0
Parent:
1:26e3869ba544
Child:
3:046e6f173f9e

File content as of revision 2:51b3c5ba45f0:

#include "mbed.h"
#include "Servo.h"
#include "TextLCD.h"
#include "SDFileSystem.h"

TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
Serial pc(USBTX, USBRX);
SDFileSystem sd(p5, p6, p7, p8, "sd");

void logWrite(){
}

int main() {
    lcd.printf("Hello World\n RFID_doorlock");
    printf("hello world");
    wait(1);
    lcd.cls();
    lcd.printf("opening files now...");
    FILE *fp = fopen("/sd/rdoor/userlist.txt", "r"); //user list(sd)
    FILE *fp2 = fopen("/sd/rdoor/log.txt", "a"); //logfile(sd)
    fprintf(fp2, "Power source is turned on now") ;//power on log
    wait(1);
    
    if (fp == NULL) {
        lcd.cls(); //gamen no syokika
        lcd.printf("could not read USERLIST");
        fprintf(fp2, "could not read USERLIST.TXT\n"); //readerror log
        error("could not read USERLIST.TXT\n");
    } else {
        lcd.printf("Completed opening files!!");
    }
    fclose(fp);
    fclose(fp2);
    
    lcd.cls();
    lcd.printf("Thank you! i will sleep soon");    
}