esp-arduino-apboot
esp-arduino-apboot copied to clipboard
Issue with launchWeb function
Hi I had a problem with an error. When starting the ESP for the first time, it should open the Access Point, and consequently the mDNS should be configured to run using the WiFi.softApIp, not the WiFi.localIp, as you do within your code. This generated an error and did not started the web server. Here is how I tried to fix the function.
void launchWeb(int webtype) {
Serial.println("");
Serial.println("WiFi connected");
Serial.println(WiFi.localIP());
Serial.println(WiFi.softAPIP());
IPAddress ip2BeUsed;
if(webtype==1) {
ip2BeUsed = WiFi.softAPIP();
} else {
ip2BeUsed = WiFi.localIP();
}
if (!mdns.begin("esp8266", ip2BeUsed)) {
Serial.println("Error setting up MDNS responder!");
while(1) {
delay(1000);
}
}
Serial.println("mDNS responder started");
// Start the server
server.begin();
Serial.println("Server started");
int b = 20;
int c = 0;
while(b == 20) {
b = mdns1(webtype);
}
}
I hope it helps Thanks for your great work Pierluigi
I am still facing the issue with "launchWeb". execution stops at infinite while loop with error "Error setting up MDNS responder!". Please help me.
I'm also having the message "Error setting up MDNS responder!" all the time even thought I made the fix above. What can I do to fix it? Thanks in advance.
I have the same problem : "Error setting up MDNS responder!"
I tried the @pluisi fix but I'm still facing the problem
How can I fix it ?
Thanks
I'm using Arduino 1.6.5 IDE & NodeMcu board
Looking at the code in the mDNS header the second parameter is ignored anyway:
bool begin(const char* hostName);
//for compatibility
bool begin(const char* hostName, IPAddress ip, uint32_t ttl=120){
return begin(hostName);
}
You need WiFi.mode(WIFI_AP);
before WiFi.softAP(ssid);
. Without setting mode, mdns.begin("esp8266")
returns false.