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.
Dependents: ton_demo ton_template
Diff: ESP8266.h
- Revision:
- 2:3a73d77c2cef
- Parent:
- 0:cbba28a205fa
--- a/ESP8266.h Tue Nov 08 00:17:12 2016 +0000
+++ b/ESP8266.h Thu Jun 29 20:11:00 2017 +0000
@@ -23,9 +23,19 @@
bool connect(const char* ssid, const char* pass, uint8_t mode = 0)
{
+ // Set CWMODE to 1=Station,2=AP,3=BOTH, default mode 1 (Station)
+ strcpy(cmdbuff, "AT+CWMODE=1\r\n");
+ sendCMD();
+ getReply(500, 20);
+
+ // DHCP Enabled in Station Mode
+ strcpy(cmdbuff, "AT+CWDHCP=1,1\r\n");
+ sendCMD();
+ getReply(500, 20);
+
sprintf(cmdbuff,"AT+CWJAP=\"%s\",\"%s\"\r\n", ssid, pass);
sendCMD();
- getReply(8000, 50);
+ getReply(10000, 200);
if (strstr(replybuff, "OK") == NULL) return false;
@@ -144,6 +154,10 @@
sendCMD();
getReply(500, 10);
+ sprintf(cmdbuff, "AT+CIPCLOSE\r\n");
+ sendCMD();
+ getReply(500, 600);
+
return false;
}
else