mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Merge pull request #7631 from Erriez/feature/documentation-wifi-multi
Add WiFi Multi to readme.rst
This commit is contained in:
commit
d0300806cd
@ -156,6 +156,39 @@ The Client class creates `clients <https://en.wikipedia.org/wiki/Client_(computi
|
||||
|
||||
Check out the separate section with `list of functions <client-class.rst>`__
|
||||
|
||||
WiFi Multi
|
||||
~~~~~~~~~~
|
||||
|
||||
`ESP8266WiFiMulti.h` can be used to connect to a WiFi network with strongest WiFi signal (RSSI). This requires registering one or more access points with SSID and password. It automatically switches to another WiFi network when the WiFi connection is lost.
|
||||
|
||||
Example:
|
||||
|
||||
.. code:: cpp
|
||||
#include <ESP8266WiFiMulti.h>
|
||||
|
||||
ESP8266WiFiMulti wifiMulti;
|
||||
|
||||
// WiFi connect timeout per AP. Increase when connecting takes longer.
|
||||
const uint32_t connectTimeoutMs = 5000;
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Set in station mode
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
||||
// Register multi WiFi networks
|
||||
wifiMulti.addAP("ssid_from_AP_1", "your_password_for_AP_1");
|
||||
wifiMulti.addAP("ssid_from_AP_2", "your_password_for_AP_2");
|
||||
wifiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Maintain WiFi connection
|
||||
if (wifiMulti.run(connectTimeoutMs) == WL_CONNECTED) {
|
||||
...
|
||||
}
|
||||
}
|
||||
|
||||
BearSSL Client Secure and Server Secure
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
Loading…
x
Reference in New Issue
Block a user