NM500 TEST PGM

Dependencies:   NM500Lib_Socket NM500_Test_Socket SDFileSystem_Socket mbed

Revision:
1:f4d825b196e7
Parent:
0:bdbd3d6fc5d5
Child:
2:343b407cf6aa
--- a/main.cpp	Fri Dec 07 11:25:01 2012 +0000
+++ b/main.cpp	Mon Jun 29 01:38:35 2015 +0000
@@ -1,8 +1,10 @@
 #include "mbed.h"
 #include "SDFileSystem.h"
- 
-SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
- 
+
+#define MAX_SIZE 100 
+SDFileSystem sd(PB_3, PB_2, PB_1, PB_0, "sd"); // the pinout on the mbed Cool Components workshop board
+
+char sdread[MAX_SIZE];
 int main() {
     printf("Hello World!\n");   
  
@@ -14,6 +16,14 @@
     }
     fprintf(fp, "Hello fun SD Card World!");
     fclose(fp); 
- 
-    printf("Goodbye World!\n");
+    
+    printf("Reading from SD card...\r\n");
+    fp = fopen("/sd/mydir/sdtest.txt", "r");
+    if (fp != NULL) {
+         fgets(sdread,MAX_SIZE,fp);
+         printf("READ_STR = %s", sdread);
+        fclose(fp);
+    } else {
+        printf("failed!\n");
+    }
 }