mbed sd

Dependencies:   SDFileSystem mbed

Revision:
0:27143f32cefd
Child:
1:456047999cb0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jul 15 01:21:28 2016 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+#include "SDFileSystem.h"
+ 
+SDFileSystem sd(PA_14, PA_13, PA_12, PA_11, "sd"); // the pinout on the mbed Cool Components workshop board  SDFileSystem sd(PB_03, PB_02, PB_01, PB_00, "sd");
+//SDFileSystem sd(PB_03, PB_02, PB_01, PB_00, "sd");
+Serial uart1(PA_13,PA_14);
+int main() {
+    uart1.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 SD1 Card World!");
+    fclose(fp); 
+ 
+    uart1.printf("Goodbye World!\n");
+}