test
Fork of ESP8266 by
Revision 3:ba8baa31f906, committed 2015-05-23
- Comitter:
- fookies
- Date:
- Sat May 23 03:54:26 2015 +0000
- Parent:
- 2:77388e8f0697
- Commit message:
- integate wifi
Changed in this revision
ESP8266.cpp | Show annotated file Show diff for this revision Revisions of this file |
ESP8266.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 77388e8f0697 -r ba8baa31f906 ESP8266.cpp --- a/ESP8266.cpp Sun Dec 28 21:58:49 2014 +0000 +++ b/ESP8266.cpp Sat May 23 03:54:26 2015 +0000 @@ -1,5 +1,5 @@ #include "ESP8266.h" - +#include <string.h> // Constructor ESP8266::ESP8266(PinName tx, PinName rx, int br) : comm(tx, rx) { comm.baud(br); @@ -165,4 +165,11 @@ char rs[20]; strcpy(rs, "AT+CIPSERVER=0"); SendCMD(rs); +} +void ESP8266::setAP(char * ssid, char * pass, int channel) { + char rs[100]; + strcpy(rs, "AT+CIPMUX=1"); + SendCMD(rs); + sprintf(rs,"AT+CWSAP=\"%s\",\"%s\",%d,4",ssid,pass,channel); + SendCMD(rs); } \ No newline at end of file
diff -r 77388e8f0697 -r ba8baa31f906 ESP8266.h --- a/ESP8266.h Sun Dec 28 21:58:49 2014 +0000 +++ b/ESP8266.h Sat May 23 03:54:26 2015 +0000 @@ -34,6 +34,7 @@ void GetConnStatus(char * st); void StartServerMode(int port); void CloseServerMode(void); +void setAP(char * ssid, char * pass, int channel); private: Serial comm;