It is a door opener with mbed and Felica(RFID).
Dependencies: mbed Servo SDFileSystem
main.cpp@1:26e3869ba544, 2011-12-23 (annotated)
- Committer:
- ryought
- Date:
- Fri Dec 23 03:58:47 2011 +0000
- Revision:
- 1:26e3869ba544
- Parent:
- 0:6d5f4f45b3a7
- Child:
- 2:51b3c5ba45f0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ryought | 1:26e3869ba544 | 1 | #include "mbed.h" |
ryought | 1:26e3869ba544 | 2 | #include "Servo.h" |
ryought | 1:26e3869ba544 | 3 | #include "TextLCD.h" |
ryought | 1:26e3869ba544 | 4 | #include "SDFileSystem.h" |
ryought | 1:26e3869ba544 | 5 | |
ryought | 1:26e3869ba544 | 6 | TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7 |
ryought | 1:26e3869ba544 | 7 | Serial pc(USBTX, USBRX); |
ryought | 1:26e3869ba544 | 8 | SDFileSystem sd(p5, p6, p7, p8, "sd"); |
ryought | 1:26e3869ba544 | 9 | |
ryought | 1:26e3869ba544 | 10 | void logWrite(){ |
ryought | 1:26e3869ba544 | 11 | } |
ryought | 1:26e3869ba544 | 12 | |
ryought | 1:26e3869ba544 | 13 | int main() { |
ryought | 1:26e3869ba544 | 14 | lcd.printf("Hello World\n RFID_doorlock"); |
ryought | 1:26e3869ba544 | 15 | printf("hello world"); |
ryought | 1:26e3869ba544 | 16 | FILE *fp = fopen("/sd/rdoor/userlist.txt", "r"); //user list(sd) |
ryought | 1:26e3869ba544 | 17 | FILE *fp2 = fopen("/sd/rdoor/log.txt", "a"); //logfile(sd) |
ryought | 1:26e3869ba544 | 18 | fprintf(fp2, "Power source is turned on now") ;//power on log |
ryought | 1:26e3869ba544 | 19 | |
ryought | 1:26e3869ba544 | 20 | if (fp == NULL) { |
ryought | 1:26e3869ba544 | 21 | error("could not read USERLIST.TXT\n"); |
ryought | 1:26e3869ba544 | 22 | lcd.cls(); //gamen no syokika |
ryought | 1:26e3869ba544 | 23 | lcd.printf("could not read USERLIST"); |
ryought | 1:26e3869ba544 | 24 | fprintf(fp2, "could not read USERLIST.TXT\n"); //readerror log |
ryought | 1:26e3869ba544 | 25 | } |
ryought | 1:26e3869ba544 | 26 | |
ryought | 1:26e3869ba544 | 27 | fclose(fp); |
ryought | 1:26e3869ba544 | 28 | fclose(fp2); |
ryought | 1:26e3869ba544 | 29 | |
ryought | 1:26e3869ba544 | 30 | lcd.cls(); |
ryought | 1:26e3869ba544 | 31 | lcd.printf("Thank you! i will sleep soon"); |
ryought | 1:26e3869ba544 | 32 | } |