esp8266-webserver
esp8266-webserver copied to clipboard
This does NOT work properly.
I'm beyond frustrated with this ESP8266WebServer. It works, sometimes. Even just using the plain example code. It's randomly not responding, etc. What a piece of junk.
For example, just load the default page and refresh your browser 10x. It will fail. If it doesn't, try 20x.
:P Wow... I am surprised the 8266 Arduino library is so buggy. I eventually sorted this out. I don't want to say how much time I spent on this issue.
In SOFT_AP mode the device fails to respond consistently. Replicate this simply by running a SoftAP example web server and executing "ping youripaddress -t" from the command line. You might see a few requests go through before it starts failing to respond. Sometimes it does respond, just not constantly.
Solve this by adding MDSN to your sketch!?! ...I have no idea, but I swear, this fixes the problem and the 8266 responds EVERY single time.
Just add...
#include <ESP8266mDNS.h>
To the top of your Sketch.
Then add...
WiFi.hostname("ESP8266");
Before your "softAP(ssid, pwd)" line.
And last...
MDNS.begin("ESP8266");
MDNS.addService("http", "tcp", 80);
After your "softAP(ssid, pwd)" line.
Interesting Thanks!, you are right it works! Black magic!. This has been solved in Arduino core 2.4.1 (probably earlier too).