Simple configuration program for the ESP8266 Wi-Fi module. Includes baud rate changes. If module [Vendor:www.ai-thinker.com Version:0.9.2.4], the baud rate can be changed from 9600(default) to 230400. Other baud rates that did not work: 460800, 921600. These will set but could not get stable communications. No complicated libraries, once configured the module will store the settings ready to be used in the application. Can be reconfigured if required. Start with 9600, i.e. esp.baud(9600); If no response try esp.baud(57600); and esp.baud(115200); After config completes the program continuously gets AP and IP list.

Dependencies:   mbed

Revision:
2:c5515c7eba46
Parent:
1:4a9cc6d8c33d
Child:
3:14e33fec26c3
--- a/main.cpp	Tue Feb 10 16:35:26 2015 +0000
+++ b/main.cpp	Tue Feb 10 16:59:16 2015 +0000
@@ -9,16 +9,16 @@
 char buf[1024];
 char snd[255];
 
-char ssid[32] = "ssid";    // enter router ssid inside the quotes
-char pwd [32] = "password";    // enter router password inside the quotes
+char ssid[32] = "ssid";     // enter router ssid inside the quotes
+char pwd [32] = "password"; // enter router password inside the quotes
 
 void SendCMD(),getreply(),ESPconfig(),ESPsetbaudrate();
 
 
 int main() {
     
-    pc.baud(115200);    // set what you want here depending on your terminal program speed
-    esp.baud(115200);   // change this to the new ESP8266 baudrate if it is changed at any time.    
+    pc.baud(115200);  // set what you want here depending on your terminal program speed
+    esp.baud(9600);   // change this to the new ESP8266 baudrate if it is changed at any time.    
     
     //ESPsetbaudrate();   //******************  include this routine to set a different ESP8266 baudrate  ******************
 
@@ -46,18 +46,17 @@
     getreply();
     pc.printf(buf);
     
-    wait(1);
-   
+    wait(1);   
    
     pc.printf("\n---------- Get Version ----------\r\n");
     strcpy(snd,"AT+GMR\r\n");
     SendCMD();
     timeout=1;
     getreply();
-    pc.printf(buf);
+    pc.printf(buf);    
     
-    
-    wait(1);    
+    wait(1);
+        
     // set CWMODE to 1=Station,2=AP,3=BOTH, default mode 1 (Station)
     pc.printf("\n---------- Setting Mode ----------\r\n");
     strcpy(snd, "AT+CWMODE=1\r\n");
@@ -68,6 +67,16 @@
     
     wait(1);
     
+    // set CIPMUX to 0=Single,1=Multi 
+    pc.printf("\n---------- Setting Connection Mode ----------\r\n");
+    strcpy(snd, "AT+CIPMUX=1\r\n"); 
+    SendCMD();
+    timeout=1;
+    getreply();
+    pc.printf(buf);
+    
+    wait(1);
+    
     pc.printf("\n---------- Listing Acces Points ----------\r\n");
     strcpy(snd, "AT+CWLAP\r\n");
     SendCMD();