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

Dependencies:   mbed

Revision:
4:65f657998b7d
Parent:
3:b593f43b7251
Child:
5:79618eee4d54
diff -r b593f43b7251 -r 65f657998b7d initiateWifi.cpp
--- a/initiateWifi.cpp	Thu May 25 10:37:33 2017 +0000
+++ b/initiateWifi.cpp	Thu May 25 11:27:17 2017 +0000
@@ -27,8 +27,9 @@
     "AT+CWJAP=\"Hotspot\",\"password\"",   //name and password of wifi
     "AT+CIFSR",
     "AT+CIPMUX=1",
-    "AT+CIPSERVER=1,8080",
-    "AT+CIPSEND=0,"
+    "AT+CIPSTART=4","TCP","172.217.23.19","5005", //connect to soroush's server
+    "AT+CIPSEND=4,1"
+    "a" // send a single char
 };
 
 
@@ -73,7 +74,7 @@
     nextBuff = buffer; //make nextbuff point to beginning fo buffe
 
     while(esp.readable()) {
-        d = esp.getc(); // get character sent by the esp
+        d = esp.getc(); // get character sent by the esp 
 
         pc.putc(d); // get character sent by the esp
         * nextBuff = d; //store in nextBuff
@@ -122,10 +123,10 @@
 
     pc.attach(&pc_recv, Serial::RxIrq); // attach the two interrupt services
     esp.attach(&esp_recv, Serial::RxIrq);
-    for (char i=10; i>0; i--) {
+    for (char i=5; i>0; i--) {
         pc.printf("%d\r\n", i);
         wait(1);
     }
-    start();
+    //start();
 
 }
\ No newline at end of file