You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
post pn https://randomnerdtutorials.com/esp32-wi-fi-manager-asyncwebserver/#comment-722588
JB
January 30, 2022 at 6:49 am
the server.on POST part can also be done like this.
server.on("/", HTTP_POST, [](AsyncWebServerRequest *request) {
if (request->hasParam("ssid", true) && (request->hasParam("pass", true) && request->hasParam("ip", true))){
pass = request->getParam("pass", true)->value();
ssid = request->getParam("ssid", true)->value();
ip = request->getParam("ip", true)->value();
Serial.print("SSID set to: ");
Serial.println(ssid);
// Write file to save value
writeFile(SPIFFS, ssidPath, ssid.c_str());
Serial.print("Password set to: ");
Serial.println(pass);
// Write file to save value
writeFile(SPIFFS, passPath, pass.c_str());
Serial.print("IP Address set to: ");
Serial.println(ip);
// Write file to save value
writeFile(SPIFFS, ipPath, ip.c_str());
request->send(200, "text/plain", "Done. ESP will restart, connect to your router and go to IP address: " + ip);
delay(3000);
ESP.restart();
}
});
Beta Was this translation helpful? Give feedback.
All reactions