You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
758 B
33 lines
758 B
/*
|
|
This sketch trys to Connect to the best AP based on a given list
|
|
|
|
*/
|
|
|
|
#include <ESP8266WiFi.h>
|
|
#include <ESP8266WiFiMulti.h>
|
|
|
|
ESP8266WiFiMulti wifiMulti;
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
|
|
WiFi.mode(WIFI_STA);
|
|
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");
|
|
|
|
Serial.println("Connecting Wifi...");
|
|
if (wifiMulti.run() == WL_CONNECTED) {
|
|
Serial.println("");
|
|
Serial.println("WiFi connected");
|
|
Serial.println("IP address: ");
|
|
Serial.println(WiFi.localIP());
|
|
}
|
|
}
|
|
|
|
void loop() {
|
|
if (wifiMulti.run() != WL_CONNECTED) {
|
|
Serial.println("WiFi not connected!");
|
|
delay(1000);
|
|
}
|
|
}
|
|
|