Hallo, ich bin ein ziemlicher Anfänger bezüglich ESP32.
ich wollte eine WiFi Verbindung zu meinem router (Speedport W921V) aufbauen. Dies ist jedoch nicht gelungen. asswort und SSID habe ich oft genug kontrolliert, die sind richtig.
Wenn ich mit demselben Sketch eine Verbindung zu meinem smartphone Hotspot aufbaue, klappt das sofort.
Ich habe die router Einstellungen gesprüft. Mir ist nichts aufgefallen. Es sind alle computer zugelassen und auch sonst keinerlei Beschränkungen gesetzt
Im englischen Teil des Forum müssen die Beiträge und Diskussionen in englischer Sprache verfasst werden. Deswegen wurde diese Diskussion in den deutschen Teil des Forums verschoben.
Und wenn der Speedport beides unter der selben SSID bereitstellt, gibt es auch gerne Probleme.
Deshalb hatte ich damals unterschiedliche SSID´s für die Netzte gewählt und dann ging es.
WiFi.mode(WIFI_STA);
WiFi.setHostname(hostname.c_str()); //define hostname
WiFi.begin("MyCTeg", "xxxxxxxxxxxxxxxxxx");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Ich verbinde mich mit dem Internet...");
}
Serial.println("Ich bin mit dem Internet verbunden!");
}
void loop() {
// put your main code here, to run repeatedly:
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
void setup() {
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
// it is a good practice to make sure your code sets wifi mode how you want it.
// put your setup code here, to run once:
Serial.begin(115200);
//WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wm;
// reset settings - wipe stored credentials for testing
// these are stored by the esp library
// wm.resetSettings();
// Automatically connect using saved credentials,
// if connection fails, it starts an access point with the specified name ( "AutoConnectAP"),
// if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect())
// then goes into a blocking loop awaiting configuration and will return success result
bool res;
// res = wm.autoConnect(); // auto generated AP name from chipid
res = wm.autoConnect("AutoConnectAP"); // anonymous ap
// res = wm.autoConnect("AutoConnectAP","password"); // password protected ap
if(!res) {
Serial.println("Failed to connect");
// ESP.restart();
}
else {
//if you get here you have connected to the WiFi
Serial.println("connected...yeey :)");
}
}
void loop() {
// put your main code here, to run repeatedly:
}
Grosses Vorteil? Sie ändern von Netzwerk ohne Änderungen in ihren code.