SD Example

Dependencies:   SDFileSystem mbed

Files at this revision

API Documentation at this revision

Comitter:
gerardo_carmona
Date:
Thu Nov 20 21:07:00 2014 +0000
Commit message:
SD Example

Changed in this revision

SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
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
diff -r 000000000000 -r 1a8003e5f568 SDFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Thu Nov 20 21:07:00 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/SDFileSystem/#7b35d1709458
diff -r 000000000000 -r 1a8003e5f568 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 20 21:07:00 2014 +0000
@@ -0,0 +1,38 @@
+/*
+    My SDcard
+    
+    Trying to save data in a file, but instead of replacing old data
+    i would like to append it.
+    
+*/
+
+#include "mbed.h"
+#include "SDFileSystem.h"
+
+// Puertos
+DigitalOut rled(LED_RED);
+DigitalOut gled(LED_GREEN);
+SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); // MOSI, MISO, SCK, CS
+
+// Objetos
+FILE *fp;
+
+char buffer[1024];
+
+int main(){
+    rled = 1;
+    wait(1);
+    while (true) {
+        FILE *fp = fopen("/sd/test.txt", "r");
+        if (fp == 0){
+            printf("Could not open file\n");
+        }else{
+            int x;
+            while ((x = fgetc(fp)) != EOF){
+                printf("%c", x);
+            }
+            fclose(fp);
+        } // IF
+        wait(1);
+    } // WHILE
+} // MAIN
diff -r 000000000000 -r 1a8003e5f568 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 20 21:07:00 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file