meh

Dependencies:   SDFileSystem mbed

Files at this revision

API Documentation at this revision

Comitter:
ricardobtez
Date:
Tue Apr 05 23:55:58 2016 +0000
Commit message:
neg

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.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r ff4a712c20b4 SDFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Tue Apr 05 23:55:58 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/ricardobtez/code/SDFileSystem/#67d91ce77b10
diff -r 000000000000 -r ff4a712c20b4 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Apr 05 23:55:58 2016 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "SDFileSystem.h"
+
+Serial pc(PTC4,PTC3);
+SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd");
+
+
+int main() {
+    pc.baud(9600);
+    pc.printf("Bienvenido");
+    char f[10] = {"/sd/mydir"};
+    char fll[23] = {"/sd/mydir/archivo1.txt"};
+    char datos[1024];
+    char *carpeta;
+    char *archivo;
+    int serial=0;
+    int i = 0;
+    char terminante = 0;
+    carpeta = &f[0]; 
+    archivo = &fll[0];
+    mkdir("/sd/",0777);
+    mkdir(carpeta,0777);
+    FILE *fl = fopen(archivo, "w");
+    if(fl == NULL) {
+        error("Could not open file for write\n");
+    }
+    i = 0;
+    pc.printf("\nEl archivo se llama archivo1.txt \n\r");
+    pc.printf("\nContenido del archivo. termina con escape '\n\r");
+    do{
+        if(pc.readable()){
+          serial = pc.getc();
+          if(serial == 0x1B) terminante = 1;
+          else datos[i++] = serial;
+        }
+    }while(!terminante);
+    fprintf(fl, &datos[0]);
+    fclose(fl);     
+    pc.printf("Listo");
+}
\ No newline at end of file
diff -r 000000000000 -r ff4a712c20b4 mbed.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Tue Apr 05 23:55:58 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/ricardobtez/code/mbed/#16969dd821af