Communicates with the WiFi - be very careful when using as it is tempremental.

Dependencies:   mbed

Revision:
8:e09edf050cca
Parent:
7:bfb2b5142c29
Child:
9:8cf34e4f9ca0
--- a/initiateWifi.cpp	Thu May 25 12:12:58 2017 +0000
+++ b/initiateWifi.cpp	Thu May 25 15:06:50 2017 +0000
@@ -15,16 +15,17 @@
 DigitalOut blueLED(LED3);  //to prove it's working
 
 char input; //character to store inputs/outputs in communication
+
+char * getRequest = "GET /HTTP/1.1\r\nHost:172.217.23.19\r\n\r\n";
+
 char* startCommands[10]= {
-    "AT",
-    "AT",
-    "AT",
     "AT+RST",
     "AT+CWMODE=1",
     //"AT+CWJAP=\"Hotspot\",\"password\"", skip signing in for debugging purposes
-    "AT+CIPMUX=0",
-    "AT+CIPSTART=\"TCP\",\"172.217.23.19\",80", // change to 172.217.23.19\", \"80\"",
-    "AT+CIPSEND=0",
+    "AT+CIPMUX=1",
+    "AT+CIPSTART=1,\"TCP\",\"172.217.23.19\",80", // change to 172.217.23.19\", \"80\"",
+    "AT+CIPSEND=1,45",
+    getRequest
 };
 
 
@@ -77,7 +78,7 @@
         esp.putc(c);
 
 
-        if(c==13) {
+        if(c=='x') {
             pc.printf("\r\ncommand %d",k);  //identify the command number
             pc.printf("\r\n");
 
@@ -89,6 +90,9 @@
             } else {
                 k=0;
             }
+        } else if(c==13) {
+            pc.putc(10); //ie makes enter perform as expected
+            esp.putc(10);
         }
     }
 }