Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Server-ESP8266 by
Revision 6:c92b4601e449, committed 2017-12-11
- Comitter:
- chanagan2540
- Date:
- Mon Dec 11 15:16:47 2017 +0000
- Parent:
- 5:569ef8ad0b45
- Commit message:
- esp8266;
Changed in this revision
diff -r 569ef8ad0b45 -r c92b4601e449 ESP8266.cpp --- a/ESP8266.cpp Mon Dec 11 07:16:36 2017 +0000 +++ b/ESP8266.cpp Mon Dec 11 15:16:47 2017 +0000 @@ -155,13 +155,14 @@ SendCMD(rs); } -void ESP8266::StartServerMode(int port) { - char rs[25]; - char t[4]; - strcpy(rs, "AT+CIPSERVER=1,"); - itoa(port, t); - strcat(rs, t); - SendCMD(rs); +void ESP8266::StartServerMode(void) { + char cmd[255]; + strcpy(cmd, "AT+CIPSERVER="); + AddChar(cmd, 0x31); + AddChar(cmd, 0x2C); + AddChar(cmd, 0x38); + AddChar(cmd, 0x30); + SendCMD(cmd); } void ESP8266::SetTransfer(void) {
diff -r 569ef8ad0b45 -r c92b4601e449 ESP8266.h --- a/ESP8266.h Mon Dec 11 07:16:36 2017 +0000 +++ b/ESP8266.h Mon Dec 11 15:16:47 2017 +0000 @@ -40,7 +40,7 @@ void SetSingle(void); void SetMultiple(void); void GetConnStatus(char * st); -void StartServerMode(int port); +void StartServerMode(void); void CloseServerMode(void); private:
diff -r 569ef8ad0b45 -r c92b4601e449 main.cpp --- a/main.cpp Mon Dec 11 07:16:36 2017 +0000 +++ b/main.cpp Mon Dec 11 15:16:47 2017 +0000 @@ -2,8 +2,8 @@ #include <string> #include "ESP8266.h" //////////////// -ESP8266 esp(D8, D2, 9600); -Serial pc(D1, D0); +ESP8266 esp(D8, D2, 115200); +Serial pc(D1, D0, 115200); char snd[255], rcv[1000]; @@ -60,7 +60,7 @@ wait(4); pc.printf("Start server mode on port 80\r\n"); - esp.StartServerMode(80); + esp.StartServerMode(); esp.RcvReply(rcv, 1000); pc.printf("%s", rcv); wait(4);