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

Files at this revision

API Documentation at this revision

Comitter:
simon
Date:
Mon Sep 06 10:01:55 2010 +0000
Parent:
0:aee5cf626b88
Commit message:
Update example to include mkdir(), and use the pinout of the cool components workshop board

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- 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");
     }
--- a/mbed.bld	Thu Jun 03 16:35:25 2010 +0000
+++ b/mbed.bld	Mon Sep 06 10:01:55 2010 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/029aa53d7323
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e