Skip to content

Commit

Permalink
Update to TON Board V1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
krebyy committed Jun 24, 2017
1 parent ace3873 commit 2e5f7dc
Show file tree
Hide file tree
Showing 3 changed files with 221 additions and 186 deletions.
16 changes: 15 additions & 1 deletion ESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ class ESP8266 {

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;

Expand Down Expand Up @@ -144,6 +154,10 @@ class ESP8266 {
sendCMD();
getReply(500, 10);

sprintf(cmdbuff, "AT+CIPCLOSE\r\n");
sendCMD();
getReply(500, 600);

return false;
}
else
Expand Down
Loading

0 comments on commit 2e5f7dc

Please sign in to comment.