n-Bed testing SD
Dependencies: SDFileSystem mbed
Fork of SDFileSystem_HelloWorld by
main.cpp@1:a306b267f71d, 2015-01-22 (annotated)
- Committer:
- chalikias
- Date:
- Thu Jan 22 18:31:27 2015 +0000
- Revision:
- 1:a306b267f71d
- Parent:
- 0:bdbd3d6fc5d5
works
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chalikias | 1:a306b267f71d | 1 | //N.C. testing n-bed SD-CARD |
chalikias | 1:a306b267f71d | 2 | |
mbed_official | 0:bdbd3d6fc5d5 | 3 | #include "mbed.h" |
mbed_official | 0:bdbd3d6fc5d5 | 4 | #include "SDFileSystem.h" |
chalikias | 1:a306b267f71d | 5 | //mosi miso sck cs |
chalikias | 1:a306b267f71d | 6 | SDFileSystem sd(p11, p12, p13, P3_25, "sd"); // n-bed on board SD-CARD |
mbed_official | 0:bdbd3d6fc5d5 | 7 | |
mbed_official | 0:bdbd3d6fc5d5 | 8 | int main() { |
mbed_official | 0:bdbd3d6fc5d5 | 9 | printf("Hello World!\n"); |
mbed_official | 0:bdbd3d6fc5d5 | 10 | |
mbed_official | 0:bdbd3d6fc5d5 | 11 | mkdir("/sd/mydir", 0777); |
mbed_official | 0:bdbd3d6fc5d5 | 12 | |
mbed_official | 0:bdbd3d6fc5d5 | 13 | FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); |
mbed_official | 0:bdbd3d6fc5d5 | 14 | if(fp == NULL) { |
mbed_official | 0:bdbd3d6fc5d5 | 15 | error("Could not open file for write\n"); |
mbed_official | 0:bdbd3d6fc5d5 | 16 | } |
chalikias | 1:a306b267f71d | 17 | fprintf(fp, "Hello n-bed SD Card "); |
mbed_official | 0:bdbd3d6fc5d5 | 18 | fclose(fp); |
mbed_official | 0:bdbd3d6fc5d5 | 19 | |
chalikias | 1:a306b267f71d | 20 | printf("Goodbye n-bed World!\n"); |
mbed_official | 0:bdbd3d6fc5d5 | 21 | } |