Exclusive code for server communication

Dependencies:   mbed-rtos mbed

Fork of test_thread by GR_Peach_Abhinav_Rahul

Files at this revision

API Documentation at this revision

Comitter:
RahulSitaram
Date:
Sat Jan 14 06:42:58 2017 +0000
Parent:
4:fd0d5e707091
Commit message:
Committed on 14-01-2017 12:10 PM

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Jan 09 18:00:57 2017 +0000
+++ b/main.cpp	Sat Jan 14 06:42:58 2017 +0000
@@ -21,16 +21,15 @@
         Wifi.printf("GET reneproj.esy.es/");
         Wifi.printf("peach/index.php?device_token=jabv5su2&device");
         Wifi.printf("_id=gr_peach1&command4u=00 HTTP/1.1\r\n");
-        if(Wifi.readable()){
+    }
+}
+void read_from_wifi(){
+     if(Wifi.readable()){
             while(Wifi.readable()){
                 read_data = Wifi.getc();
                 pc.putc(read_data);
             }
         }
-    }
-}
-void send_to_device(string command){
-    
  
     }
 void setup_esp8266(){
@@ -63,8 +62,8 @@
  }
  
 int main() {
+    Wifi.attach(&read_from_wifi);
     setup_esp8266();
-    uint8_t data[3] = {0x47, 0x32, 0xA7};
     while (true) {
         wait(10);
     }