Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By sej7278
#74875 I tried wifi multi, but because you have to use delay() to give it some time to connect, i never managed to get it under 4 seconds, most of the time it was 5, and that doesn't even include actually getting an IP etc; just authenticating with the AP.

Code: Select all#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

ESP8266WiFiMulti wifiMulti;

void setup()
{
    Serial.begin(115200);

    WiFi.mode(WIFI_STA);
    wifiMulti.addAP("AP_ONE", "password1");
    wifiMulti.addAP("AP_TWO", "password2");

    unsigned long start_time = millis();

    while (wifiMulti.run() != WL_CONNECTED)
    {
        delay(50);
    }

    unsigned long end_time = millis();
    unsigned long elapsed_time = end_time - start_time;

    Serial.println();
    Serial.print("start: "); Serial.println(start_time);
    Serial.print("end: "); Serial.println(end_time);
    Serial.print("elapsed: "); Serial.println(elapsed_time);
    Serial.println();
    Serial.print("Connection status: "); Serial.println(WiFi.status());
    Serial.println();
    WiFi.printDiag(Serial);
}

void loop()
{
}


The problem is the return codes don't work, you only ever get a 3 or 6, i'm sure if 1 (WL_NO_SSID_AVAIL) worked it would be almost instant.