
Checking SD
Dependencies: mbed SDFileSystem
Diff: main.cpp
- Revision:
- 2:cc13d5354037
- Parent:
- 0:bdbd3d6fc5d5
--- a/main.cpp Tue May 16 05:18:55 2017 +0000 +++ b/main.cpp Tue Dec 29 04:57:32 2020 +0000 @@ -1,19 +1,21 @@ #include "mbed.h" #include "SDFileSystem.h" - -SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board - -int main() { - printf("Hello World!\n"); - + +Serial pc(USBTX, USBRX); +SDFileSystem sd(D11, D12, D13, D9, "sd"); + +int main() +{ + pc.printf("Hello World!\n"); + mkdir("/sd/mydir", 0777); - + FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); if(fp == NULL) { error("Could not open file for write\n"); } fprintf(fp, "Hello fun SD Card World!"); - fclose(fp); - - printf("Goodbye World!\n"); + fclose(fp); + + pc.printf("Goodbye World!\n"); }