Connect Wi-Fi

Dependencies:   mbed

Fork of Server-ESP8266 by Digital dog

Revision:
5:569ef8ad0b45
Parent:
4:217a562d8950
Child:
6:c92b4601e449
--- a/main.cpp	Sun Dec 10 18:46:42 2017 +0000
+++ b/main.cpp	Mon Dec 11 07:16:36 2017 +0000
@@ -29,20 +29,21 @@
     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("Setting Wifi\r\n");
+//    pc.printf("Setting Wifi\r\n");
 //    esp.SetWiFi("ESP8266-MIND", "mindkafuu");
 //    esp.RcvReply(rcv, 1000);
 //    pc.printf("%s", rcv);
 //    wait(4);
-
+//
     pc.printf("Connecting to AP\r\n");
-    esp.Join("BIN11_2G", "789789BN"); // 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);
 
@@ -51,17 +52,7 @@
     esp.RcvReply(rcv, 400);
     pc.printf("%s", rcv);
     wait(2);
-
-    pc.printf("Check Wifi\r\n");
-    esp.look();
-    esp.RcvReply(rcv, 400);
-    pc.printf("%s", rcv);
-    wait(2);
-
-    pc.printf("Getting IP\r\n");
-    esp.GetIP(rcv);
-    pc.printf("%s", rcv);
-
+    
     pc.printf("Setting multiple connections\r\n");
     esp.SetMultiple();
     esp.RcvReply(rcv, 1000);
@@ -74,10 +65,20 @@
     pc.printf("%s", rcv);
     wait(4);
     
-    while(1) {
-        esp.CheckIP();
-        esp.RcvReply(rcv, 5000);
-        pc.printf("%s", rcv);
-        wait(2);
-    }
+    pc.printf("Getting IP\r\n");
+    esp.GetIP(rcv);
+    pc.printf("%s", rcv);
+   
+//    pc.printf("Connect to Server\r\n");
+//    esp.SetPath("TCP", "192.168.1.56", "80");
+//    esp.RcvReply(rcv, 1000);
+//    pc.printf("%s", rcv);
+//    wait(4);
+//    
+    //while(1) {
+//        esp.Recieve(5);
+//        esp.RcvReply(rcv, 1000);
+//        pc.printf("%s", rcv);
+//        wait(4);
+//    }
 }
\ No newline at end of file