5 An
ESP8266 library
for Arduino providing an easy-to-use way to manipulate
ESP8266.
9 Source can be download at <https:
17 Online API documentation can be reached at <http:
19 Offline API documentation can be found under directory
24 On the home page of API documentation, the tabs of Examples, Classes and Modules
25 will be useful
for Arduino lovers.
29 bool kick (
void) : Verify
ESP8266 whether live or not.
31 bool restart (void) : Restart
ESP8266 by
"AT+RST".
33 String getVersion (void) : Get the version of AT Command Set.
35 bool setOprToStation (void) : Set operation mode to staion.
37 bool setOprToSoftAP (void) : Set operation mode to softap.
39 bool setOprToStationSoftAP (void) : Set operation mode to station + softap.
41 String getAPList (void) : Search available AP list and return it.
43 bool joinAP (String ssid, String pwd) : Join in AP.
45 bool leaveAP (void) : Leave AP joined before.
47 bool setSoftAPParam (String ssid, String pwd, uint8_t chl=7, uint8_t ecn=4) : Set SoftAP parameters.
49 String getJoinedDeviceIP (void) : Get the IP list of devices connected to SoftAP.
51 String getIPStatus (void) : Get the current status of connection(UDP and TCP).
53 String getLocalIP (void) : Get the IP address of
ESP8266.
55 bool enableMUX (void) : Enable IP MUX(multiple connection mode).
57 bool disableMUX (void) : Disable IP MUX(single connection mode).
59 bool createTCP (String addr, uint32_t port) : Create TCP connection in single mode.
61 bool releaseTCP (void) : Release TCP connection in single mode.
63 bool registerUDP (String addr, uint32_t port) : Register UDP port number in single mode.
65 bool unregisterUDP (void) : Unregister UDP port number in single mode.
67 bool createTCP (uint8_t mux_id, String addr, uint32_t port) : Create TCP connection in multiple mode.
69 bool releaseTCP (uint8_t mux_id) : Release TCP connection in multiple mode.
71 bool registerUDP (uint8_t mux_id, String addr, uint32_t port) : Register UDP port number in multiple mode.
73 bool unregisterUDP (uint8_t mux_id) : Unregister UDP port number in multiple mode.
75 bool setTCPServerTimeout (uint32_t timeout=180) : Set the timeout of TCP Server.
77 bool startServer (uint32_t port=333) : Start Server(Only in multiple mode).
79 bool stopServer (void) : Stop Server(Only in multiple mode).
81 bool startTCPServer (uint32_t port=333) : Start TCP Server(Only in multiple mode).
83 bool stopTCPServer (void) : Stop TCP Server(Only in multiple mode).
85 bool send (const uint8_t *buffer, uint32_t len) : Send data based on TCP or UDP builded already in single mode.
87 bool send (uint8_t mux_id, const uint8_t *buffer, uint32_t len) : Send data based on one of TCP or UDP builded already in multiple mode.
89 uint32_t recv (uint8_t *buffer, uint32_t buffer_size, uint32_t timeout=1000) : Receive data from TCP or UDP builded already in single mode.
91 uint32_t recv (uint8_t mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout=1000) : Receive data from one of TCP or UDP builded already in multiple mode.
93 uint32_t recv (uint8_t *coming_mux_id, uint8_t *buffer, uint32_t buffer_size, uint32_t timeout=1000) : Receive data from all of TCP or UDP builded already in multiple mode.
98 - RAM: not less than 2KBytes
99 - Serial: one serial (HardwareSerial or SoftwareSerial) at least
101 # Suppported Mainboards
103 - Arduino UNO and its derivatives
104 - Arduino MEGA and its derivatives
105 - [Iteaduino UNO](http:
108 # Using SoftwareSerial
110 If you want to use SoftwareSerial to communicate with
ESP8266, you need to modify
115 After modification, it should be:
117 #define ESP8266_USE_SOFTWARE_SERIAL
120 # Hardware Connection
122 WeeESP8266 library only needs an uart for hardware connection. All communications
123 are done via uart. In each example, you must specify the uart used by mainboard
124 to communicate with
ESP8266 flashed AT firmware.
126 ## MEGA and WBoard Pro
128 For MEGA and WBoard Pro, `Serial1` will be used if you create an object (named wifi)
129 of class
ESP8266 in your code like this:
134 The connection should be like these:
144 To use SoftwareSerial, `mySerial` will be used
if you create an object (named wifi)
145 of
class ESP8266 in your code like this:
148 #include <SoftwareSerial.h>
150 SoftwareSerial mySerial(3, 2);
153 The connection should be like these:
163 The size of data from
ESP8266 is too big for arduino sometimes, so the library can't
164 receive the whole buffer because the size of the hardware serial buffer which is
165 defined in HardwareSerial.h is too small.
167 Open the file from `\arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.h`.
168 See the follow line in the HardwareSerial.h file.
170 #define SERIAL_BUFFER_SIZE 64
172 The default size of the buffer is 64. Change it into a bigger number, like 256 or more.
175 -------------------------------------------------------------------------------
179 -------------------------------------------------------------------------------
Provide an easy-to-use way to manipulate ESP8266.