From 9c9e193f7f6dc04644ab7865b7123edb3a71640c Mon Sep 17 00:00:00 2001 From: Erriez Date: Sat, 3 Oct 2020 17:14:25 +0200 Subject: [PATCH] Add WiFi Multi to readme.rst --- doc/esp8266wifi/readme.rst | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/doc/esp8266wifi/readme.rst b/doc/esp8266wifi/readme.rst index f51b7f495..23ec9a329 100644 --- a/doc/esp8266wifi/readme.rst +++ b/doc/esp8266wifi/readme.rst @@ -156,6 +156,39 @@ The Client class creates `clients `__ +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 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~