ESP8266

Dependencies:   mbed

Fork of Client-ESP8266 by Digital dog

Revision:
3:2df821b3eb35
Parent:
2:a3692ba08124
Child:
4:484b0a418fed
--- a/main.cpp	Sun Dec 10 18:46:31 2017 +0000
+++ b/main.cpp	Mon Dec 11 07:16:00 2017 +0000
@@ -27,17 +27,18 @@
     esp.SetMode(1);
     esp.RcvReply(rcv, 1000);
     pc.printf("%s", rcv);
+    wait(2);
     
-    pc.printf("Receiving Wifi List\r\n");
-    esp.GetList(rcv);
-    pc.printf("%s", rcv);
+//    pc.printf("Receiving Wifi List\r\n");
+//    esp.GetList(rcv);
+//    pc.printf("%s", rcv);
     
     pc.printf("Connecting to AP\r\n");
-    esp.Join("ESP8266-MIND", "mindkafuu"); // Replace MyAP and MyPasswd with your SSID and password
-    esp.RcvReply(rcv, 1000);
+    esp.Join("Mind", "mmmmmmmm"); // Replace MyAP and MyPasswd with your SSID and password
+    esp.RcvReply(rcv, 5000);
     pc.printf("%s", rcv);
     wait(8);
-    
+
     pc.printf("Check Connected\r\n");
     esp.look();
     esp.RcvReply(rcv, 400);
@@ -47,7 +48,13 @@
     pc.printf("Getting IP\r\n");
     esp.GetIP(rcv);
     pc.printf("%s", rcv);
-    
+        
+//    pc.printf("Set transfer mode\r\n");
+//    esp.transfer();
+//    esp.RcvReply(rcv, 1000);
+//    pc.printf("%s", rcv);
+//    wait(2);
+            
     pc.printf("Setting single connections\r\n");
     esp.SetSingle();
     esp.RcvReply(rcv, 1000);
@@ -55,15 +62,21 @@
     wait(4);
     
     pc.printf("Connect to Server\r\n");
-    esp.SetPath("TCP", "192.168.1.53", "80");
-    esp.RcvReply(rcv, 1000);
+    esp.SetPath("UDP", "172.20.10.2", "80");
+    esp.RcvReply(rcv, 5000);
     pc.printf("%s", rcv);
     wait(4);
     
-    while(1) {
-        esp.SetPath("TCP", "192.168.4.1", "80");
-        esp.RcvReply(rcv, 5000);
-        pc.printf("%s", rcv);
-        wait(2);
-    }
+    pc.printf("Sent\r\n");
+    esp.sent();
+    esp.RcvReply(rcv, 1000);
+    pc.printf("%s", rcv);
+    wait(4);
+        
+    //while(1) {
+//        esp.SetPath("TCP", "192.168.1.53", "80");
+//        esp.RcvReply(rcv, 5000);
+//        pc.printf("%s", rcv);
+//        wait(2);
+//    }
 }
\ No newline at end of file