wifi
Dependencies: mbed
Fork of ESP8266-configuration-mbed-LPC1768 by
Diff: main.cpp
- 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();