file
Dependencies: SDFileSystem mbed
Fork of SDFileSystem_HelloWorld by
main.cpp@1:55b4dc63f976, 2015-11-25 (annotated)
- Committer:
- nehap
- Date:
- Wed Nov 25 09:34:46 2015 +0000
- Revision:
- 1:55b4dc63f976
- Parent:
- 0:bdbd3d6fc5d5
file;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:bdbd3d6fc5d5 | 1 | #include "mbed.h" |
mbed_official | 0:bdbd3d6fc5d5 | 2 | #include "SDFileSystem.h" |
nehap | 1:55b4dc63f976 | 3 | Serial pc(USBTX, USBRX); |
mbed_official | 0:bdbd3d6fc5d5 | 4 | SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board |
mbed_official | 0:bdbd3d6fc5d5 | 5 | |
nehap | 1:55b4dc63f976 | 6 | int main() |
nehap | 1:55b4dc63f976 | 7 | { |
nehap | 1:55b4dc63f976 | 8 | printf("Welcome to sd card interface\n"); |
mbed_official | 0:bdbd3d6fc5d5 | 9 | |
mbed_official | 0:bdbd3d6fc5d5 | 10 | mkdir("/sd/mydir", 0777); |
mbed_official | 0:bdbd3d6fc5d5 | 11 | |
nehap | 1:55b4dc63f976 | 12 | FILE *fp = fopen("/sd/mydir/Heo world.docx", "r"); |
nehap | 1:55b4dc63f976 | 13 | if(fp == NULL) |
nehap | 1:55b4dc63f976 | 14 | { |
nehap | 1:55b4dc63f976 | 15 | error("not able to open for read operation\n"); |
mbed_official | 0:bdbd3d6fc5d5 | 16 | } |
nehap | 1:55b4dc63f976 | 17 | fprintf(fp,"Hello fun SD Card World\n"); |
mbed_official | 0:bdbd3d6fc5d5 | 18 | fclose(fp); |
mbed_official | 0:bdbd3d6fc5d5 | 19 | |
nehap | 1:55b4dc63f976 | 20 | printf("found\n"); |
mbed_official | 0:bdbd3d6fc5d5 | 21 | } |