In the words of Tim Gun... make it work
Fork of ESP8266-configuaration-baudrate by
Revision 4:699631e7f60d, committed 2018-11-01
- Comitter:
- hydroguy45
- Date:
- Thu Nov 01 20:51:56 2018 +0000
- Parent:
- 3:14e33fec26c3
- Commit message:
- Please work
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 14e33fec26c3 -r 699631e7f60d main.cpp --- a/main.cpp Tue Feb 10 17:14:53 2015 +0000 +++ b/main.cpp Thu Nov 01 20:51:56 2018 +0000 @@ -1,7 +1,7 @@ #include "mbed.h" Serial pc(USBTX, USBRX); -Serial esp(PTE0, PTE1); // tx, rx +Serial esp(p13, p14); // tx, rx Timer t; @@ -9,8 +9,8 @@ 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] = "hp-setup-1"; // enter router ssid inside the quotes +char pwd [32] = "WelcomeHal"; // enter router password inside the quotes void SendCMD(),getreply(),ESPconfig(),ESPsetbaudrate(); @@ -20,7 +20,7 @@ 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 ****************** + ESPsetbaudrate(); //****************** include this routine to set a different ESP8266 baudrate ****************** ESPconfig(); //****************** include Config to set the ESP8266 configuration *********************** @@ -40,7 +40,8 @@ timeout=2; getreply(); pc.printf(buf); - } + } + } @@ -49,6 +50,7 @@ { strcpy(snd, "AT+CIOBAUD=115200\r\n"); // change the numeric value to the required baudrate SendCMD(); + esp.baud(115200); } // +++++++++++++++++++++++++++++++++ This is for ESP8266 config only, run this once to set up the ESP8266 +++++++++++++++ @@ -94,7 +96,7 @@ pc.printf(buf); wait(1); - + /* pc.printf("\n---------- Listing Acces Points ----------\r\n"); strcpy(snd, "AT+CWLAP\r\n"); SendCMD(); @@ -103,7 +105,7 @@ pc.printf(buf); wait(1); - + */ pc.printf("\n---------- Connecting to AP ----------\r\n"); pc.printf("ssid = %s pwd = %s\r\n",ssid,pwd); strcpy(snd, "AT+CWJAP=\""); @@ -156,5 +158,4 @@ ended = 1;t.stop();t.reset(); } } -} - \ No newline at end of file +} \ No newline at end of file