An example using the SDFileSystem library to create a directory and write a fiel to an SD card, using its SPI interface
Dependencies: mbed SDFileSystem
Diff: main.cpp
- Revision:
- 1:27aaaa9f462b
- Parent:
- 0:aee5cf626b88
diff -r aee5cf626b88 -r 27aaaa9f462b main.cpp --- a/main.cpp Thu Jun 03 16:35:25 2010 +0000 +++ b/main.cpp Mon Sep 06 10:01:55 2010 +0000 @@ -1,12 +1,16 @@ +// example writing to SD card, sford + #include "mbed.h" #include "SDFileSystem.h" -SDFileSystem sd(p11, p12, p13, p27, "sd"); +SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board int main() { printf("Hello World!\n"); - FILE *fp = fopen("/sd/sdtest.txt", "w"); + mkdir("/sd/mydir", 0777); + + FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); if(fp == NULL) { error("Could not open file for write\n"); }