Created
March 30, 2021 22:11
-
-
Save mcspr/430ba0b302faf9497c9492a41bad7dd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
void setup() { | |
delay(1000); | |
Serial.begin(115200); | |
Serial.println(); | |
WiFi.mode(WIFI_OFF); | |
} | |
struct Auth { | |
String ssid; | |
String pass; | |
}; | |
Auth auths[2] { | |
{"OldSSID", "OldPassword"}, | |
{"NewSSID", "NewPassword"} | |
}; | |
void loop() { | |
static auto current = std::begin(auths); | |
static auto begin = std::begin(auths); | |
static auto end = std::end(auths); | |
static unsigned long last { millis() }; | |
if (millis() - last > 10000) { | |
last = millis(); | |
WiFi.mode(WIFI_OFF); | |
WiFi.softAP((*current).ssid, (*current).pass); | |
delay(100); | |
IPAddress myIP = WiFi.softAPIP(); | |
Serial.print("AP name: "); | |
Serial.println((*current).ssid); | |
Serial.print("AP IP address: "); | |
Serial.println(myIP); | |
current; | |
if (current == end) { | |
current = begin; | |
} | |
} | |
delay(10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment