You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/esp8266wifi/client-examples.rst
+1-1
Original file line number
Diff line number
Diff line change
@@ -249,7 +249,7 @@ In case server's web address is incorrect, or server is not accessible, you shou
249
249
Conclusion
250
250
~~~~~~~~~~
251
251
252
-
With this simple example we have demonstrated how to set up a client program, connect it to a server, request a web page and retrieve it. Now you should be able to write your own client program for ESP8266 and move to more advanced dialogue with a server, like e.g. using `HTTPS <https://en.wikipedia.org/wiki/HTTPS>`__ protocol with the :doc:`Client Secure <client-secure-examples>` .
252
+
With this simple example we have demonstrated how to set up a client program, connect it to a server, request a web page and retrieve it. Now you should be able to write your own client program for ESP8266 and move to more advanced dialogue with a server, like e.g. using `HTTPS <https://en.wikipedia.org/wiki/HTTPS>`__ protocol with the `Client Secure <client-secure-examples.rst>`__ .
:alt:Connection log on Arduino IDE's Serial Monitor
53
53
54
-
alt text
55
54
56
55
How does it work? In the first line of sketch ``#include <ESP8266WiFi.h>`` we are including `ESP8266WiFi <https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WiFi>`__ library. This library provides ESP8266 specific Wi-Fi routines we are calling to connect to network.
57
56
@@ -95,8 +94,6 @@ ESP8266 module can operate as a station, so we can connect it to the Wi-Fi netwo
:alt:ESP8266 operating in the Station + Soft Access Point mode
97
96
98
-
alt text
99
-
100
97
The `ESP8266WiFi <https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WiFi>`__ library provides wide collection of C++
101
98
`methods <https://en.wikipedia.org/wiki/Method_(computer_programming)>`__ (functions) and `properties <https://en.wikipedia.org/wiki/Property_(programming)>`__ to configure and operate an ESP8266 module in station and / or soft access point mode. They are described in the following chapters.
102
99
@@ -108,8 +105,6 @@ The `ESP8266WiFi <https://github.com/esp8266/Arduino/tree/master/libraries/ESP82
108
105
.. figure:: pictures/doxygen-class-index.png
109
106
:alt:Index of classes of ESP8266WiFi library
110
107
111
-
alt text
112
-
113
108
Chapters below describe all function calls (`methods <https://en.wikipedia.org/wiki/Method_(computer_programming)>`__ and `properties <https://en.wikipedia.org/wiki/Property_(programming)>`__ in C++ terms) listed in particular classes of `ESP8266WiFi <https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WiFi>`__. Description is illustrated with application examples and code snippets to show how to use functions in practice. Most of this information is broken up into separate documents. Please follow to access them.
114
109
115
110
Station
@@ -120,13 +115,11 @@ Station (STA) mode is used to get ESP module connected to a Wi-Fi network establ
120
115
.. figure:: pictures/esp8266-station.png
121
116
:alt:ESP8266 operating in the Station mode
122
117
123
-
alt text
124
-
125
118
Station class has several features to facilitate management of Wi-Fi connection. In case the connection is lost, ESP8266 will automatically reconnect to the last used access point, once it is again available. The same happens on module reboot. This is possible since ESP is saving credentials to last used access point in flash (non-volatile) memory. Using the saved data ESP will also reconnect if sketch has been changed but code does not alter the Wi-Fi mode or credentials.
126
119
127
-
:doc:`Station Class documentation <station-class>`
120
+
`Station Class documentation <station-class.rst>`__
128
121
129
-
Check out separate section with :doc:`examples <station-examples>`.
122
+
Check out separate section with `examples <station-examples.rst>`__.
130
123
131
124
Soft Access Point
132
125
~~~~~~~~~~~~~~~~~
@@ -137,24 +130,22 @@ and connects them further to a wired network. ESP8266 can provide similar functi
:alt:ESP8266 operating in the Soft Access Point mode
139
132
140
-
alt text
141
-
142
133
The soft-AP mode is often used and an intermediate step before connecting ESP to a Wi-Fi in a station mode. This is when SSID and password to such network is not known upfront. ESP first boots in soft-AP mode, so we can connect to it using a laptop or a mobile phone. Then we are able to provide credentials to the target network. Once done ESP is switched to the station mode and can connect to the target Wi-Fi.
143
134
144
135
Another handy application of soft-AP mode is to set up `mesh networks <https://en.wikipedia.org/wiki/Mesh_networking>`__. ESP can operate in both soft-AP and Station mode so it can act as a node of a mesh network.
145
136
146
-
:doc:`Soft Access Point Class documentation <soft-access-point-class>`
137
+
`Soft Access Point Class documentation <soft-access-point-class.rst>`__
147
138
148
-
Check out separate section with :doc:`examples <soft-access-point-examples>`.
139
+
Check out separate section with `examples <soft-access-point-examples.rst>`__.
149
140
150
141
Scan
151
142
~~~~
152
143
153
144
To connect a mobile phone to a hot spot, you typically open Wi-Fi settings app, list available networks and pick the hot spot you need. Then enter a password (or not) and you are in. You can do the same with ESP. Functionality of scanning for, and listing of available networks in range is implemented by the Scan Class.
154
145
155
-
:doc:`Scan Class documentation <scan-class>`.
146
+
`Scan Class documentation <scan-class.rst>`__
156
147
157
-
Check out separate section with :doc:`examples <scan-examples>`.
148
+
Check out separate section with `examples <scan-examples.rst>`__.
158
149
159
150
Client
160
151
~~~~~~
@@ -164,10 +155,7 @@ The Client class creates `clients <https://en.wikipedia.org/wiki/Client_(computi
164
155
.. figure:: pictures/esp8266-client.png
165
156
:alt:ESP8266 operating as the Client
166
157
167
-
alt text
168
-
169
-
Check out separate section with :doc:`examples <client-examples>` / :doc:`list of functions
170
-
<client-class>`
158
+
Check out separate section with `examples <client-examples.rst>`__ / `list of functions <client-class.rst>`__
171
159
172
160
Client Secure
173
161
~~~~~~~~~~~~~
@@ -177,11 +165,9 @@ The Client Secure is an extension of `Client Class <#client>`__ where connection
177
165
.. figure:: pictures/esp8266-client-secure.png
178
166
:alt:ESP8266 operating as the Client Secure
179
167
180
-
alt text
181
-
182
168
Secure applications have additional memory (and processing) overhead due to the need to run cryptography algorithms. The stronger the certificate's key, the more overhead is needed. In practice it is not possible to run more than a single secure client at a time. The problem concerns RAM memory we can not add, the flash memory size is usually not the issue. If you like to learn how `client secure library <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/WiFiClientSecure.h>`__ has been developed, access to what servers have been tested, and how memory limitations have been overcame, read fascinating issue report `#43 <https://github.com/esp8266/Arduino/issues/43>`__.
183
169
184
-
Check out separate section with :doc:`examples <client-secure-examples>` / :doc:`list of functions <client-secure-class>`
170
+
Check out separate section with `examples <client-secure-examples.rst>`__ / `list of functions <client-secure-class.rst>`__
185
171
186
172
Server
187
173
~~~~~~
@@ -191,25 +177,23 @@ The Server Class creates `servers <https://en.wikipedia.org/wiki/Server_(computi
191
177
.. figure:: pictures/esp8266-server.png
192
178
:alt:ESP8266 operating as the Server
193
179
194
-
alt text
195
-
196
180
Clients connect to sever to send and receive data and access provided functionality.
197
181
198
-
Check out separate section with :doc:`examples <server-examples>` / :doc:`list of functions <server-class>`.
182
+
Check out separate section with `examples <server-examples.rst>`__ / `list of functions <server-class.rst>`__.
199
183
200
184
UDP
201
185
~~~
202
186
203
187
The UDP Class enables the `User Datagram Protocol (UDP) <https://en.wikipedia.org/wiki/User_Datagram_Protocol>`__ messages to be sent and received. The UDP uses a simple "fire and forget" transmission model with no guarantee of delivery, ordering, or duplicate protection. UDP provides checksums for data integrity, and port numbers for addressing different functions at the source and destination of the datagram.
204
188
205
-
Check out separate section with :doc:`examples <udp-examples>` / :doc:`list of functions <udp-class>`.
189
+
Check out separate section with `examples <udp-examples.rst>`__ / `list of functions <udp-class.rst>`__.
206
190
207
191
Generic
208
192
~~~~~~~
209
193
210
194
There are several functions offered by ESP8266's `SDK <http://bbs.espressif.com/viewtopic.php?f=51&t=1023>`__ and not present in `Arduino WiFi library <https://www.arduino.cc/en/Reference/WiFi>`__. If such function does not fit into one of classes discussed above, it will likely be in Generic Class. Among them is handler to manage Wi-Fi events like connection, disconnection or obtaining an IP, Wi-Fi mode changes, functions to manage module sleep mode, hostname to an IP address resolution, etc.
211
195
212
-
Check out separate section with :doc:`examples <generic-examples>` / :doc:`list of functions <generic-class>`.
196
+
Check out separate section with `examples <generic-examples.rst>`__ / `list of functions <generic-class.rst>`__.
213
197
214
198
Diagnostics
215
199
-----------
@@ -271,7 +255,7 @@ Use this function to provide snapshot of Wi-Fi status in these parts of applicat
271
255
Enable Wi-Fi Diagnostic
272
256
~~~~~~~~~~~~~~~~~~~~~~~
273
257
274
-
By default the diagnostic output from Wi-Fi libraries is disabled when you call ``Serial.begin``. To enable debug output again, call ``Serial.setDebugOutput(true)``. To redirect debug output to ``Serial1`` instead, call ``Serial1.setDebugOutput(true)``. For additional details regarding diagnostics using serial ports please refer to :doc:`the documentation <../reference>`.
258
+
By default the diagnostic output from Wi-Fi libraries is disabled when you call ``Serial.begin``. To enable debug output again, call ``Serial.setDebugOutput(true)``. To redirect debug output to ``Serial1`` instead, call ``Serial1.setDebugOutput(true)``. For additional details regarding diagnostics using serial ports please refer to `the documentation <../reference.rst>`__.
275
259
276
260
Below is an example of output for sample sketch discussed in `Quick Start <#quick-start>`__ above with ``Serial.setDebugOutput(true)``:
277
261
@@ -314,25 +298,17 @@ To make the analysis easier, rather than looking into individual header or sourc
The tool crawls through all header and source files collecting information from formatted comment blocks. If developer of particular class annotated the code, you will see it like in examples below.
:alt:Example of documentation for station hostname propert by Doxygen
328
308
329
-
alt text
330
-
331
309
If code is not annotated, you will still see the function prototype including types of arguments, and can use provided links to jump straight to the source code to check it out on your own. Doxygen provides really excellent navigation between members of library.
:alt:Example of documentation for UDP begin method (not annotaed in code)by Doxygen
335
313
336
-
alt text
337
-
338
314
Several classes of `ESP8266WiFi <https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WiFi>`__ are not annotated. When preparing this document, `Doxygen <http://www.stack.nl/~dimitri/doxygen/>`__ has been tremendous help to quickly navigate through almost 30 files that make this library.
Copy file name to clipboardExpand all lines: doc/esp8266wifi/server-examples.rst
+2-4
Original file line number
Diff line number
Diff line change
@@ -223,8 +223,6 @@ Enter provided IP address in a web browser. You should see the page served by ES
223
223
.. figure:: pictures/server-browser-output.png
224
224
:alt:Output from server in a web browser
225
225
226
-
alt text
227
-
228
226
The page would be refreshed every 5 seconds. Each time this happens, you should see a request from the client (your web browser) printed out on the serial monitor:
229
227
230
228
::
@@ -243,7 +241,7 @@ The page would be refreshed every 5 seconds. Each time this happens, you should
243
241
What Else?
244
242
~~~~~~~~~~
245
243
246
-
Looking on :doc:`client examples <client-examples>` you will quickly find out the similarities in protocol to the server. The protocol starts with a header that contains information what communication will be about. It contains what content type is communicated or accepted like ``text/html``. It states whether connection will be kept alive or closed after submission of the header. It contains identification of the sender like ``User-Agent: Mozilla/5.0 (Windows NT 6.1)``, etc.
244
+
Looking on `client examples <client-examples.rst>`__ you will quickly find out the similarities in protocol to the server. The protocol starts with a header that contains information what communication will be about. It contains what content type is communicated or accepted like ``text/html``. It states whether connection will be kept alive or closed after submission of the header. It contains identification of the sender like ``User-Agent: Mozilla/5.0 (Windows NT 6.1)``, etc.
247
245
248
246
Conclusion
249
247
~~~~~~~~~~
@@ -252,4 +250,4 @@ The above example shows that a web server on ESP8266 can be set up in almost no
252
250
253
251
If you like to try another server example, check out `WiFiWebServer.ino <https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiWebServer/WiFiWebServer.ino>`__, that provides functionality of toggling the GPIO pin on and off out of a web browser.
254
252
255
-
For the list of functions provided to implement and manage servers, please refer to the :doc:`Server Class <server-class>` documentation.
253
+
For the list of functions provided to implement and manage servers, please refer to the `Server Class <server-class.rst>`__ documentation.
Copy file name to clipboardExpand all lines: doc/esp8266wifi/soft-access-point-class.rst
+1-1
Original file line number
Diff line number
Diff line change
@@ -224,4 +224,4 @@ Optionally you can use function without any parameters that returns a ``String``
224
224
225
225
MAC address = 5E:CF:7F:8B:10:13
226
226
227
-
For code samples please refer to separate section with :doc:`examples <soft-access-point-examples>` dedicated specifically to the Soft Access Point Class.
227
+
For code samples please refer to separate section with `examples <soft-access-point-examples.rst>`__ dedicated specifically to the Soft Access Point Class.
Copy file name to clipboardExpand all lines: doc/esp8266wifi/station-examples.rst
+2-2
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Table of Contents
19
19
Introduction
20
20
~~~~~~~~~~~~
21
21
22
-
Following the example in\`Quick Start <readme.rst#quick-start>`__, we would like to go one step further and made ESP connect to next available access point if current connection is lost. This functionality is provided with 'ESP8266WiFiMulti' class and demonstrated in sketch below.
22
+
Following the example in `Quick Start <readme.rst#quick-start>`__, we would like to go one step further and made ESP connect to next available access point if current connection is lost. This functionality is provided with 'ESP8266WiFiMulti' class and demonstrated in sketch below.
23
23
24
24
.. code:: cpp
25
25
@@ -202,4 +202,4 @@ I believe the minimalist sketch with ``ESP8266WiFiMulti`` class is a cool exampl
202
202
203
203
As shown in above example, reconnecting between access points takes time and is not seamless. Therefore, in practical applications, you will likely need to monitor connection status to decide e.g. if you can send the data to external system or should wait until connection is back.
204
204
205
-
For detailed review of functions provided to manage station mode please refer to the :doc:`Station Class <station-class>` documentation.
205
+
For detailed review of functions provided to manage station mode please refer to the `Station Class <station-class.rst>`__ documentation.
Copy file name to clipboardExpand all lines: doc/esp8266wifi/udp-class.rst
+1-1
Original file line number
Diff line number
Diff line change
@@ -33,4 +33,4 @@ Multicast UDP
33
33
34
34
The ``WiFiUDP`` class supports sending and receiving multicast packets on STA interface. When sending a multicast packet, replace ``udp.beginPacket(addr, port)`` with ``udp.beginPacketMulticast(addr, port, WiFi.localIP())``. When listening to multicast packets, replace ``udp.begin(port)`` with ``udp.beginMulticast(WiFi.localIP(), multicast_ip_addr, port)``. You can use ``udp.destinationIP()`` to tell whether the packet received was sent to the multicast or unicast address.
35
35
36
-
For code samples please refer to separate section with :doc:`examples <udp-examples>` dedicated specifically to the UDP Class.
36
+
For code samples please refer to separate section with `examples <udp-examples.rst>`__ dedicated specifically to the UDP Class.
Copy file name to clipboardExpand all lines: doc/esp8266wifi/udp-examples.rst
+1-3
Original file line number
Diff line number
Diff line change
@@ -171,8 +171,6 @@ What I have entered is shown below:
171
171
.. figure:: pictures/udp-packet-sender.png
172
172
:alt:Testing UDP with packet sender
173
173
174
-
alt text
175
-
176
174
Now click *Send*.
177
175
178
176
Immediately after that you should see the following on ESP's serial monitor:
@@ -191,4 +189,4 @@ Conclusion
191
189
192
190
This simple example shows how to send and receive UDP packets between ESP and an external application. Once tested in this minimal set up, you should be able to program ESP to talk to any other UDP device. In case of issues to establish communication with a new device, use the `Packet Sender <https://packetsender.com>`__ or other similar program for troubleshooting
193
191
194
-
For review of functions provided to send and receive UDP packets, please refer to the :doc:`UDP Class <udp-class>` documentation.
192
+
For review of functions provided to send and receive UDP packets, please refer to the `UDP Class <udp-class.rst>`__ documentation.
0 commit comments