source: rtos_arduino/trunk/arduino_lib/libraries/ESP8266/README.md@ 143

Last change on this file since 143 was 143, checked in by ertl-honda, 8 years ago

Milkcocoa用に更新

File size: 6.7 KB
Line 
1@mainpage
2
3# WeeESP8266 updated for Milkcoca SDK
4
5An ESP8266 library for Arduino providing an easy-to-use way to manipulate ESP8266.
6Updated to support Milkcoca SDK<>, M0 and TOPPERS/R2CA.
7
8# Source
9Source can be download at <>.
10Original source can be download at <https://github.com/itead/ITEADLIB_Arduino_WeeESP8266>.
11
12You can clone it by:
13
14 git clone https://github.com/itead/ITEADLIB_Arduino_WeeESP8266.git
15
16# Documentation
17
18Online API documentation can be reached at <http://docs.iteadstudio.com/ITEADLIB_Arduino_WeeESP8266/index.html>.
19
20Offline API documentation can be found under directory
21[doc](https://github.com/itead/ITEADLIB_Arduino_WeeESP8266/tree/master/doc).
22
23# How to get started
24
25On the home page of API documentation, the tabs of Examples, Classes and Modules
26will be useful for Arduino lovers.
27
28# API List
29
30 bool kick (void) : Verify ESP8266 whether live or not.
31
32 bool restart (void) : Restart ESP8266 by "AT+RST".
33
34 String getVersion (void) : Get the version of AT Command Set.
35
36 bool setOprToStation (void) : Set operation mode to staion.
37
38 bool setOprToSoftAP (void) : Set operation mode to softap.
39
40 bool setOprToStationSoftAP (void) : Set operation mode to station + softap.
41
42 String getAPList (void) : Search available AP list and return it.
43
44 bool joinAP (String ssid, String pwd) : Join in AP.
45
46 bool leaveAP (void) : Leave AP joined before.
47
48 bool setSoftAPParam (String ssid, String pwd, uint8_t chl=7, uint8_t ecn=4) : Set SoftAP parameters.
49
50 String getJoinedDeviceIP (void) : Get the IP list of devices connected to SoftAP.
51
52 String getIPStatus (void) : Get the current status of connection(UDP and TCP).
53
54 String getLocalIP (void) : Get the IP address of ESP8266.
55
56 bool enableMUX (void) : Enable IP MUX(multiple connection mode).
57
58 bool disableMUX (void) : Disable IP MUX(single connection mode).
59
60 bool createTCP (String addr, uint32_t port) : Create TCP connection in single mode.
61
62 bool releaseTCP (void) : Release TCP connection in single mode.
63
64 bool registerUDP (String addr, uint32_t port) : Register UDP port number in single mode.
65
66 bool unregisterUDP (void) : Unregister UDP port number in single mode.
67
68 bool createTCP (uint8_t mux_id, String addr, uint32_t port) : Create TCP connection in multiple mode.
69
70 bool releaseTCP (uint8_t mux_id) : Release TCP connection in multiple mode.
71
72 bool registerUDP (uint8_t mux_id, String addr, uint32_t port) : Register UDP port number in multiple mode.
73
74 bool unregisterUDP (uint8_t mux_id) : Unregister UDP port number in multiple mode.
75
76 bool setTCPServerTimeout (uint32_t timeout=180) : Set the timeout of TCP Server.
77
78 bool startServer (uint32_t port=333) : Start Server(Only in multiple mode).
79
80 bool stopServer (void) : Stop Server(Only in multiple mode).
81
82 bool startTCPServer (uint32_t port=333) : Start TCP Server(Only in multiple mode).
83
84 bool stopTCPServer (void) : Stop TCP Server(Only in multiple mode).
85
86 bool send (const uint8_t *buffer, uint32_t len) : Send data based on TCP or UDP builded already in single mode.
87
88 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
90 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
92 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
94 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.
95
96# Added API List
97
98 void begin(SoftwareSerial &uart, uint32_t baud = 115200); : Begin ESP8266.
99
100 void begin(SoftwareSerial &uart, uint32_t baud = 115200); : Begin ESP8266.
101
102 bool send(String &str); : Send data based on TCP or UDP builded already in single mode.
103
104 bool send(uint8_t mux_id, String &str); : Send data based on one of TCP or UDP builded already in multiple mode.
105
106 int dataAvailable(void); : Check data is available.
107
108# Mainboard Requires
109
110 - RAM: not less than 2KBytes
111 - Serial: one serial (HardwareSerial or SoftwareSerial) at least
112
113# Suppported Mainboards
114
115 - Arduino UNO and its derivatives
116 - Arduino MEGA and its derivatives
117 - Arduino M0 and its derivatives
118 - [Iteaduino UNO](http://imall.iteadstudio.com/im130312001.html)
119 - [WBoard Pro](http://imall.iteadstudio.com/im141125005.html)
120
121# Using SoftwareSerial
122
123If you want to use SoftwareSerial to communicate with ESP8266, you need to modify
124the line in file `ESP8266.h`:
125
126 //#define ESP8266_USE_SOFTWARE_SERIAL
127
128After modification, it should be:
129
130 #define ESP8266_USE_SOFTWARE_SERIAL
131
132
133# Hardware Connection
134
135WeeESP8266 library only needs an uart for hardware connection. All communications
136are done via uart. In each example, you must specify the uart used by mainboard
137to communicate with ESP8266 flashed AT firmware.
138
139## MEGA and WBoard Pro
140
141For MEGA and WBoard Pro, `Serial1` will be used if you create an object (named wifi)
142of class ESP8266 in your code like this:
143
144 #include "ESP8266.h"
145 ESP8266 wifi(Serial1);
146
147The connection should be like these:
148
149 ESP8266_TX->RX1(D19)
150 ESP8266_RX->TX1(D18)
151 ESP8266_CH_PD->3.3V
152 ESP8266_VCC->3.3V
153 ESP8266_GND->GND
154
155## UNO
156
157To use SoftwareSerial, `mySerial` will be used if you create an object (named wifi)
158of class ESP8266 in your code like this:
159
160 #include "ESP8266.h"
161 #include <SoftwareSerial.h>
162
163 SoftwareSerial mySerial(3, 2); /* RX:D3, TX:D2 */
164 ESP8266 wifi(mySerial);
165
166The connection should be like these:
167
168 ESP8266_TX->RX(D3)
169 ESP8266_RX->TX(D2)
170 ESP8266_CH_PD->3.3V
171 ESP8266_VCC->3.3V
172 ESP8266_GND->GND
173
174# Attention
175
176The size of data from ESP8266 is too big for arduino sometimes, so the library can't
177receive the whole buffer because the size of the hardware serial buffer which is
178defined in HardwareSerial.h is too small.
179
180UNO or MEGA or WBoard Pro
181Open the file from `\arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.h`.
182
183M0
184Open the file from `\arduino\hardware\arduino\avr\cores\arduino\RingBuffer.h`.
185See the follow line in the file.
186
187 #define SERIAL_BUFFER_SIZE 64
188
189The default size of the buffer is 64. Change it into a bigger number, like 256 or more.
190
191
192-------------------------------------------------------------------------------
193
194# The End!
195
196-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.