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 ESP8266 by
Diff: ESP8266.cpp
- Revision:
- 1:399414d48048
- Parent:
- 0:e58f27687450
- Child:
- 2:77388e8f0697
diff -r e58f27687450 -r 399414d48048 ESP8266.cpp --- a/ESP8266.cpp Tue Dec 16 01:08:47 2014 +0000 +++ b/ESP8266.cpp Wed Dec 17 13:54:34 2014 +0000 @@ -87,4 +87,34 @@ strcpy(cmd, "AT+CIFSR"); SendCMD(cmd); RcvReply(ip, 2000); +} + +//Defines wifi mode; Parameter: mode; 1= STA, 2= AP, 3=both +void ESP8266::SetMode(char mode) { + char cmd[15]; + strcpy(cmd, "AT+CWMODE="); + mode = mode + 0x30; // Converts number into corresponding ASCII character + AddChar(cmd, mode); // Completes command string + SendCMD(cmd); +} + +// Quits the AP +void ESP8266::Quit(void) { + char cmd[15]; + strcpy(cmd, "AT+CWQAP"); + SendCMD(cmd); +} + +// Sets single connection +void ESP8266::SetSingle(void) { + char cmd[15]; + strcpy(cmd, "AT+CIPMUX=0"); + SendCMD(cmd); +} + +// Sets multiple connection +void ESP8266::SetMultiple(void) { + char rs[15]; + strcpy(rs, "AT+CIPMUX=1"); + SendCMD(rs); } \ No newline at end of file