It is a door opener with mbed and Felica(RFID).
Dependencies: mbed Servo SDFileSystem
Diff: main.cpp
- Revision:
- 1:26e3869ba544
- Parent:
- 0:6d5f4f45b3a7
- Child:
- 2:51b3c5ba45f0
diff -r 6d5f4f45b3a7 -r 26e3869ba544 main.cpp --- a/main.cpp Thu Dec 22 10:49:26 2011 +0000 +++ b/main.cpp Fri Dec 23 03:58:47 2011 +0000 @@ -1,5 +1,32 @@ -#include "mbed.h" -#include "Servo.h" -#include "TextLCD.h" - - +#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"); + 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 + + if (fp == NULL) { + error("could not read USERLIST.TXT\n"); + lcd.cls(); //gamen no syokika + lcd.printf("could not read USERLIST"); + fprintf(fp2, "could not read USERLIST.TXT\n"); //readerror log + } + + fclose(fp); + fclose(fp2); + + lcd.cls(); + lcd.printf("Thank you! i will sleep soon"); +} \ No newline at end of file