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