Code APP3

Dependencies:   mbed EthernetInterface WebSocketClient mbed-rtos BufferedSerial

Fork of APP3_Lab by Jean-Philippe Fournier

Revision:
4:ed53c87777f6
Parent:
3:a07b74f94890
Child:
5:9e6a09a38785
--- a/parser.cpp	Sat Sep 30 18:20:19 2017 +0000
+++ b/parser.cpp	Sat Sep 30 18:24:44 2017 +0000
@@ -1,18 +1,20 @@
+#include "parser.h"
+
 void ReadFile()
 {
+    Serial pc(USBTX, USBRX); // tx, rx
     FILE *fp = fopen("/config.txt", "r");  // Ouvrir config.txt pour lecture seulement
     if(fp == NULL)
     {
-        pc.printf("Failed to find configuration file. \n\r")
-        return -1;
+        pc.printf("Failed to find configuration file. \n\r");
     }
     else
     {
         pc.printf("Config file opened. \n\r");
-        fscanf(set,"%s",A); // read PanId
-        fscanf(set,"%s",B); // read URL        
-        printf(fp,"PanId : %s\r\n",A); // Display PanId
-        printf(fp,"ServeurURL : %s\r\n",B); // Display URL
+        fscanf(fp,"%s",&PanID); // read PanId
+        fscanf(fp,"%s",&URL); // read URL        
+        pc.printf("PanId : %s\r\n",PanID); // Display PanId
+        pc.printf("ServeurURL : %s\r\n",URL); // Display URL
         fclose(fp);
     }
 } 
\ No newline at end of file