Nuvoton
/
NuMaker-mbed-SDFileSystem-example
NuMaker SD-File-System with SD mode (deprecated after mbed OS 5.4)
Diff: main.cpp
- Revision:
- 0:c6ac37958fa3
- Child:
- 1:491561ba4bbb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 14 11:36:10 2016 +0800 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "NuSDFileSystem.h" + + + //NuSDFileSystem Nu_SD("sd"); // the pinout on the mbed Cool Components workshop board +NuSDFileSystem Nu_SD(PF_6, PF_7, PF_8, PF_5 ,PF_4, PF_3, PF_2, "sd"); + +int main() { + + printf("Hello World!\n"); + + mkdir("/sd/mydir", 0777); + + printf("Create A Dir!\n"); + + FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); + if(fp == NULL) { + error("Could not open file for write\n"); + } + printf("Create A File!\n"); + + fprintf(fp, "Hello fun SD Card World!"); + fclose(fp); + + printf("Close The File!\n"); + + printf("Goodbye World!\n"); +}