USBMSD SD card Hello World for Mbed platforms

Dependencies:   mbed USBMSD_SD USBDevice

Revision:
12:a12eb1fc05f3
Parent:
11:a26e7b7a1221
Child:
13:32b8a767cf0e
--- a/main.cpp	Wed Nov 16 17:17:42 2011 +0000
+++ b/main.cpp	Wed Nov 30 17:50:35 2011 +0000
@@ -1,21 +1,23 @@
 #include "mbed.h"
 #include "SDFileSystem.h"
 
-SDFileSystem sd(p5, p6, p7, p8, "sd");
+SDFileSystem sd(p11, p12, p13, p14, "sd");
 
-//This report will contain data to be sent
-HID_REPORT send_report;
+DigitalIn button(p16);
 
 int main() {
+    if (button) {
+        sd.connect();
+    } else {
+        mkdir("/sd/mydir", 0777);
 
-    while (1) {
-        //Fill the report
-        for (int i = 0; i < 64; i++)
-            send_report.data[i] = rand() % 100;
-        send_report.length = 64;
-        
-        //Send the report
-        sd.send(&send_report);
-        wait(2);
+        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);
+
     }
+    while (1);
 }
\ No newline at end of file