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
ESP8266.h
00001 #ifndef ESP8266_H 00002 #define ESP8266_H 00003 00004 #include <string> 00005 #include "mbed.h" 00006 00007 class ESP8266 00008 { 00009 public: 00010 /** 00011 * ESP8266 constructor 00012 * 00013 * @param tx TX pin 00014 * @param rx RX pin 00015 * @param br Baud Rate 00016 */ 00017 ESP8266(PinName tx, PinName rx, int br); 00018 00019 /** 00020 * ESP8266 destructor 00021 */ 00022 ~ESP8266(); 00023 00024 void SendCMD(char * s); 00025 void Reset(void); 00026 void RcvReply(char * r, int to); 00027 void GetList(char * l); 00028 void Join(char * id, char * pwd); 00029 void GetIP(char * ip); 00030 void SetMode(char mode); 00031 void Quit(void); 00032 void SetSingle(void); 00033 void SetMultiple(void); 00034 void GetConnStatus(char * st); 00035 void StartServerMode(int port); 00036 void CloseServerMode(void); 00037 void setAP(char * ssid, char * pass, int channel); 00038 00039 private: 00040 Serial comm; 00041 void AddEOL(char * s); 00042 void AddChar(char * s, char c); 00043 void itoa(int c, char s[]); 00044 00045 }; 00046 00047 #endif 00048 /* 00049 COMMAND TABLE 00050 Basic: 00051 AT: Just to generate "OK" reply 00052 Wifi: 00053 AT+RST: restart the module 00054 AT+CWMODE: define wifi mode; AT+CWMODE=<mode> 1= Sta, 2= AP, 3=both; Inquiry: AT+CWMODE? or AT+CWMODE=? 00055 AT+CWJAP: join the AP wifi; AT+ CWJAP =<ssid>,< pwd > - ssid = ssid, pwd = wifi password, both between quotes; Inquiry: AT+ CWJAP? 00056 AT+CWLAP: list the AP wifi 00057 AT+CWQAP: quit the AP wifi; Inquiry: AT+CWQAP=? 00058 * AT+CWSAP: set the parameters of AP; AT+CWSAP= <ssid>,<pwd>,<chl>,<ecn> - ssid, pwd, chl = channel, ecn = encryption; Inquiry: AT+CWJAP? 00059 TCP/IP: 00060 AT+CIPSTATUS: get the connection status 00061 * AT+CIPSTART: set up TCP or UDP connection 1)single connection (+CIPMUX=0) AT+CIPSTART= <type>,<addr>,<port>; 2) multiple connection (+CIPMUX=1) AT+CIPSTART= <id><type>,<addr>, <port> - id = 0-4, type = TCP/UDP, addr = IP address, port= port; Inquiry: AT+CIPSTART=? 00062 * AT+CIPSEND: send data; 1)single connection(+CIPMUX=0) AT+CIPSEND=<length>; 2) multiple connection (+CIPMUX=1) AT+CIPSEND= <id>,<length>; Inquiry: AT+CIPSEND=? 00063 * AT+CIPCLOSE: close TCP or UDP connection; AT+CIPCLOSE=<id> or AT+CIPCLOSE; Inquiry: AT+CIPCLOSE=? 00064 AT+CIFSR: Get IP address; Inquiry: AT+ CIFSR=? 00065 AT+CIPMUX: set mutiple connection; AT+ CIPMUX=<mode> - 0 for single connection 1 for mutiple connection; Inquiry: AT+CIPMUX? 00066 AT+CIPSERVER: set as server; AT+ CIPSERVER= <mode>[,<port> ] - mode 0 to close server mode, mode 1 to open; port = port; Inquiry: AT+CIFSR=? 00067 * +IPD: received data 00068 */
Generated on Sun Jul 17 2022 00:46:45 by
1.7.2
