Code APP3

Dependencies:   mbed EthernetInterface WebSocketClient mbed-rtos BufferedSerial

Fork of APP3_Lab by Jean-Philippe Fournier

Revision:
6:9ed8153f1328
Parent:
5:9e6a09a38785
Child:
8:5955af1ee445
--- a/main.cpp	Sat Sep 30 18:36:28 2017 +0000
+++ b/main.cpp	Sat Sep 30 19:09:52 2017 +0000
@@ -9,10 +9,12 @@
 
 Serial pc(USBTX, USBRX); // tx, rx
 
+char recv_buff[2048] = {0};
+
 int main() {
 
     ReadFile();
-    
+
     xbee_init();
 
     char c;
@@ -29,15 +31,24 @@
 #endif
 
     while(1) {
-        if (pc.readable())
+        /*if (pc.readable())
         {     
             c = pc.getc();
             xbee.putc(c);      
             //pc.putc(c);         
-        }
-        if (xbee.readable())
+        }*/
+
+        int recv_len = receive(recv_buff, 2048);
+
+        if (recv_len > 0)
         {
-            pc.putc(xbee.getc());            
-        }       
+            pc.printf("DATA RECEIVED : ");
+            for (int i = 0; i < recv_len; i++)
+            {
+                pc.putc(recv_buff[i]);            
+            }
+            pc.printf("\n\r");
+        }
+        
     }
 }