asdfasdf

Dependencies:   4DGL-uLCD-SE mbed SDFileSystem

Fork of final_serial by Adam Zuravleff

Files at this revision

API Documentation at this revision

Comitter:
ashea6
Date:
Wed Apr 27 21:21:32 2016 +0000
Parent:
0:78a5165b5f5e
Commit message:
final serial to sd updated

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
diff -r 78a5165b5f5e -r 592209317c79 SDFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Wed Apr 27 21:21:32 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/SDFileSystem/#c8f66dc765d4
diff -r 78a5165b5f5e -r 592209317c79 main.cpp
--- a/main.cpp	Sun Apr 24 20:09:43 2016 +0000
+++ b/main.cpp	Wed Apr 27 21:21:32 2016 +0000
@@ -1,20 +1,33 @@
 #include "mbed.h"
 #include "uLCD_4DGL.h"
+#include "SDFileSystem.h"
 
 Serial pc(USBTX, USBRX);
 DigitalOut myled(LED1);
+SDFileSystem sd(p11, p12, p13, p14, "sd"); //SD card
 uLCD_4DGL uLCD(p28,p27,p29);
 
 
-int main() {
-    char buff[10];
-    int i = 0;
-    bool flag = false;
-    while(!flag) {
-        buff[i] = pc.getc();
-        pc.putc(buff[i]);
-        flag = buff[i] == '^';
-        i++;
+int main()
+{
+    while(1) {
+        char buff[100];
+        int i = 0;
+        bool flag = false;
+        while(!flag) {
+            buff[i] = pc.getc();
+            pc.putc(buff[i]);
+            flag = buff[i] == '^';
+            i++;
+        }
+        uLCD.printf("%s", buff);
+
+        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, buff);
+        fclose(fp);
     }
-    uLCD.printf("%s", buff);
 }