[136] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml">
|
---|
| 3 | <head>
|
---|
| 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
---|
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
---|
| 6 | <meta name="generator" content="Doxygen 1.8.7"/>
|
---|
| 7 | <title>API: Main Page</title>
|
---|
| 8 | <link href="tabs.css" rel="stylesheet" type="text/css"/>
|
---|
| 9 | <script type="text/javascript" src="jquery.js"></script>
|
---|
| 10 | <script type="text/javascript" src="dynsections.js"></script>
|
---|
| 11 | <link href="doxygen.css" rel="stylesheet" type="text/css" />
|
---|
| 12 | </head>
|
---|
| 13 | <body>
|
---|
| 14 | <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
---|
| 15 | <div id="titlearea">
|
---|
| 16 | <table cellspacing="0" cellpadding="0">
|
---|
| 17 | <tbody>
|
---|
| 18 | <tr style="height: 56px;">
|
---|
| 19 | <td id="projectlogo"><img alt="Logo" src="ITEAD-logo.JPG"/></td>
|
---|
| 20 | <td style="padding-left: 0.5em;">
|
---|
| 21 | <div id="projectname">API
|
---|
| 22 | </div>
|
---|
| 23 | <div id="projectbrief">For Arduino developers</div>
|
---|
| 24 | </td>
|
---|
| 25 | </tr>
|
---|
| 26 | </tbody>
|
---|
| 27 | </table>
|
---|
| 28 | </div>
|
---|
| 29 | <!-- end header part -->
|
---|
| 30 | <!-- Generated by Doxygen 1.8.7 -->
|
---|
| 31 | <div id="navrow1" class="tabs">
|
---|
| 32 | <ul class="tablist">
|
---|
| 33 | <li class="current"><a href="index.html"><span>Main Page</span></a></li>
|
---|
| 34 | <li><a href="pages.html"><span>Related Pages</span></a></li>
|
---|
| 35 | <li><a href="annotated.html"><span>Classes</span></a></li>
|
---|
| 36 | <li><a href="files.html"><span>Files</span></a></li>
|
---|
| 37 | <li><a href="examples.html"><span>Examples</span></a></li>
|
---|
| 38 | </ul>
|
---|
| 39 | </div>
|
---|
| 40 | </div><!-- top -->
|
---|
| 41 | <div class="header">
|
---|
| 42 | <div class="headertitle">
|
---|
| 43 | <div class="title">API Documentation</div> </div>
|
---|
| 44 | </div><!--header-->
|
---|
| 45 | <div class="contents">
|
---|
| 46 | <div class="textblock"><h1>WeeESP8266</h1>
|
---|
| 47 | <p>An <a class="el" href="class_e_s_p8266.html" title="Provide an easy-to-use way to manipulate ESP8266. ">ESP8266</a> library for Arduino providing an easy-to-use way to manipulate <a class="el" href="class_e_s_p8266.html" title="Provide an easy-to-use way to manipulate ESP8266. ">ESP8266</a>.</p>
|
---|
| 48 | <h1>Source</h1>
|
---|
| 49 | <p>Source can be download at <a href="https://github.com/itead/ITEADLIB_Arduino_WeeESP8266">https://github.com/itead/ITEADLIB_Arduino_WeeESP8266</a>.</p>
|
---|
| 50 | <p>You can clone it by: </p><pre class="fragment">git clone https://github.com/itead/ITEADLIB_Arduino_WeeESP8266.git
|
---|
| 51 | </pre><h1>Documentation</h1>
|
---|
| 52 | <p>Online API documentation can be reached at <a href="http://docs.iteadstudio.com/ITEADLIB_Arduino_WeeESP8266/index.html">http://docs.iteadstudio.com/ITEADLIB_Arduino_WeeESP8266/index.html</a>.</p>
|
---|
| 53 | <p>Offline API documentation can be found under directory <a href="https://github.com/itead/ITEADLIB_Arduino_WeeESP8266/tree/master/doc">doc</a>.</p>
|
---|
| 54 | <h1>How to get started</h1>
|
---|
| 55 | <p>On the home page of API documentation, the tabs of Examples, Classes and Modules will be useful for Arduino lovers.</p>
|
---|
| 56 | <h1>API List</h1>
|
---|
| 57 | <pre class="fragment">bool kick (void) : Verify ESP8266 whether live or not.
|
---|
| 58 |
|
---|
| 59 | bool restart (void) : Restart ESP8266 by "AT+RST".
|
---|
| 60 |
|
---|
| 61 | String getVersion (void) : Get the version of AT Command Set.
|
---|
| 62 |
|
---|
| 63 | bool setOprToStation (void) : Set operation mode to staion.
|
---|
| 64 |
|
---|
| 65 | bool setOprToSoftAP (void) : Set operation mode to softap.
|
---|
| 66 |
|
---|
| 67 | bool setOprToStationSoftAP (void) : Set operation mode to station + softap.
|
---|
| 68 |
|
---|
| 69 | String getAPList (void) : Search available AP list and return it.
|
---|
| 70 |
|
---|
| 71 | bool joinAP (String ssid, String pwd) : Join in AP.
|
---|
| 72 |
|
---|
| 73 | bool leaveAP (void) : Leave AP joined before.
|
---|
| 74 |
|
---|
| 75 | bool setSoftAPParam (String ssid, String pwd, uint8_t chl=7, uint8_t ecn=4) : Set SoftAP parameters.
|
---|
| 76 |
|
---|
| 77 | String getJoinedDeviceIP (void) : Get the IP list of devices connected to SoftAP.
|
---|
| 78 |
|
---|
| 79 | String getIPStatus (void) : Get the current status of connection(UDP and TCP).
|
---|
| 80 |
|
---|
| 81 | String getLocalIP (void) : Get the IP address of ESP8266.
|
---|
| 82 |
|
---|
| 83 | bool enableMUX (void) : Enable IP MUX(multiple connection mode).
|
---|
| 84 |
|
---|
| 85 | bool disableMUX (void) : Disable IP MUX(single connection mode).
|
---|
| 86 |
|
---|
| 87 | bool createTCP (String addr, uint32_t port) : Create TCP connection in single mode.
|
---|
| 88 |
|
---|
| 89 | bool releaseTCP (void) : Release TCP connection in single mode.
|
---|
| 90 |
|
---|
| 91 | bool registerUDP (String addr, uint32_t port) : Register UDP port number in single mode.
|
---|
| 92 |
|
---|
| 93 | bool unregisterUDP (void) : Unregister UDP port number in single mode.
|
---|
| 94 |
|
---|
| 95 | bool createTCP (uint8_t mux_id, String addr, uint32_t port) : Create TCP connection in multiple mode.
|
---|
| 96 |
|
---|
| 97 | bool releaseTCP (uint8_t mux_id) : Release TCP connection in multiple mode.
|
---|
| 98 |
|
---|
| 99 | bool registerUDP (uint8_t mux_id, String addr, uint32_t port) : Register UDP port number in multiple mode.
|
---|
| 100 |
|
---|
| 101 | bool unregisterUDP (uint8_t mux_id) : Unregister UDP port number in multiple mode.
|
---|
| 102 |
|
---|
| 103 | bool setTCPServerTimeout (uint32_t timeout=180) : Set the timeout of TCP Server.
|
---|
| 104 |
|
---|
| 105 | bool startServer (uint32_t port=333) ï¼ Start Server(Only in multiple mode).
|
---|
| 106 |
|
---|
| 107 | bool stopServer (void) : Stop Server(Only in multiple mode).
|
---|
| 108 |
|
---|
| 109 | bool startTCPServer (uint32_t port=333) : Start TCP Server(Only in multiple mode).
|
---|
| 110 |
|
---|
| 111 | bool stopTCPServer (void) : Stop TCP Server(Only in multiple mode).
|
---|
| 112 |
|
---|
| 113 | bool send (const uint8_t *buffer, uint32_t len) : Send data based on TCP or UDP builded already in single mode.
|
---|
| 114 |
|
---|
| 115 | 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.
|
---|
| 116 |
|
---|
| 117 | 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.
|
---|
| 118 |
|
---|
| 119 | 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.
|
---|
| 120 |
|
---|
| 121 | 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.
|
---|
| 122 | </pre><h1>Mainboard Requires</h1>
|
---|
| 123 | <ul>
|
---|
| 124 | <li>RAM: not less than 2KBytes</li>
|
---|
| 125 | <li>Serial: one serial (HardwareSerial or SoftwareSerial) at least</li>
|
---|
| 126 | </ul>
|
---|
| 127 | <h1>Suppported Mainboards</h1>
|
---|
| 128 | <ul>
|
---|
| 129 | <li>Arduino UNO and its derivatives</li>
|
---|
| 130 | <li>Arduino MEGA and its derivatives</li>
|
---|
| 131 | <li><a href="http://imall.iteadstudio.com/im130312001.html">Iteaduino UNO</a></li>
|
---|
| 132 | <li><a href="http://imall.iteadstudio.com/im141125005.html">WBoard Pro</a></li>
|
---|
| 133 | </ul>
|
---|
| 134 | <h1>Using SoftwareSerial</h1>
|
---|
| 135 | <p>If you want to use SoftwareSerial to communicate with <a class="el" href="class_e_s_p8266.html" title="Provide an easy-to-use way to manipulate ESP8266. ">ESP8266</a>, you need to modify the line in file <code><a class="el" href="_e_s_p8266_8h.html" title="The definition of class ESP8266. ">ESP8266.h</a></code>: </p><pre class="fragment">//#define ESP8266_USE_SOFTWARE_SERIAL
|
---|
| 136 | </pre><p>After modification, it should be: </p><pre class="fragment">#define ESP8266_USE_SOFTWARE_SERIAL
|
---|
| 137 | </pre><h1>Hardware Connection</h1>
|
---|
| 138 | <p>WeeESP8266 library only needs an uart for hardware connection. All communications are done via uart. In each example, you must specify the uart used by mainboard to communicate with <a class="el" href="class_e_s_p8266.html" title="Provide an easy-to-use way to manipulate ESP8266. ">ESP8266</a> flashed AT firmware.</p>
|
---|
| 139 | <h2>MEGA and WBoard Pro</h2>
|
---|
| 140 | <p>For MEGA and WBoard Pro, <code>Serial1</code> will be used if you create an object (named wifi) of class <a class="el" href="class_e_s_p8266.html" title="Provide an easy-to-use way to manipulate ESP8266. ">ESP8266</a> in your code like this: </p><pre class="fragment">#include "ESP8266.h"
|
---|
| 141 | ESP8266 wifi(Serial1);
|
---|
| 142 | </pre><p>The connection should be like these: </p><pre class="fragment">ESP8266_TX->RX1(D19)
|
---|
| 143 | ESP8266_RX->TX1(D18)
|
---|
| 144 | ESP8266_CH_PD->3.3V
|
---|
| 145 | ESP8266_VCC->3.3V
|
---|
| 146 | ESP8266_GND->GND
|
---|
| 147 | </pre><h2>UNO</h2>
|
---|
| 148 | <p>To use SoftwareSerial, <code>mySerial</code> will be used if you create an object (named wifi) of class <a class="el" href="class_e_s_p8266.html" title="Provide an easy-to-use way to manipulate ESP8266. ">ESP8266</a> in your code like this: </p><pre class="fragment">#include "ESP8266.h"
|
---|
| 149 | #include <SoftwareSerial.h>
|
---|
| 150 |
|
---|
| 151 | SoftwareSerial mySerial(3, 2); /* RX:D3, TX:D2 */
|
---|
| 152 | ESP8266 wifi(mySerial);
|
---|
| 153 | </pre><p>The connection should be like these: </p><pre class="fragment">ESP8266_TX->RX(D3)
|
---|
| 154 | ESP8266_RX->TX(D2)
|
---|
| 155 | ESP8266_CH_PD->3.3V
|
---|
| 156 | ESP8266_VCC->3.3V
|
---|
| 157 | ESP8266_GND->GND
|
---|
| 158 | </pre><h1>Attention</h1>
|
---|
| 159 | <p>The size of data from <a class="el" href="class_e_s_p8266.html" title="Provide an easy-to-use way to manipulate ESP8266. ">ESP8266</a> is too big for arduino sometimes, so the library can't receive the whole buffer because the size of the hardware serial buffer which is defined in HardwareSerial.h is too small.</p>
|
---|
| 160 | <p>Open the file from <code>\arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.h</code>. See the follow line in the HardwareSerial.h file. </p><pre class="fragment">#define SERIAL_BUFFER_SIZE 64
|
---|
| 161 | </pre><p>The default size of the buffer is 64. Change it into a bigger number, like 256 or more.</p>
|
---|
| 162 | <hr/>
|
---|
| 163 | <h1>The End!</h1>
|
---|
| 164 | <hr/>
|
---|
| 165 | </div></div><!-- contents -->
|
---|
| 166 | <!-- start footer part -->
|
---|
| 167 | <hr class="footer"/><address class="footer"><small>
|
---|
| 168 | Generated on Tue Mar 17 2015 10:34:17 for API by  <a href="http://www.doxygen.org/index.html">
|
---|
| 169 | <img class="footer" src="doxygen.png" alt="doxygen"/>
|
---|
| 170 | </a> 1.8.7
|
---|
| 171 | </small></address>
|
---|
| 172 | </body>
|
---|
| 173 | </html>
|
---|