/* ESP32 WiFi Scanning example */
#include "WiFi.h"
void setup() {
Serial.begin(115200);
Serial.println("Initializing WiFi...");
WiFi.mode(WIFI_STA);
Serial.println("Setup done!");
std::string wifiCred[2];
std::string s = "Wokwi-GUEST;;;";
std::string delimiter = ";;;";
size_t pos = 0;
std::string token;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
wifiCred[0] = token;
Serial.println(token.c_str());
s.erase(0, pos + delimiter.length());
Serial.println(s.c_str());
wifiCred[1] = s;
}
WiFi.begin(wifiCred[0].c_str(),wifiCred[1].c_str());
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED){
delay(500);
Serial.print(".");
}
Serial.println("Connected!");
}
void loop() {
}