1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Add WiFi Multi to readme.rst

This commit is contained in:
Erriez 2020-10-03 17:14:25 +02:00
parent 85ba53a249
commit 9c9e193f7f

View File

@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~