ESP-Now Project “Unit 5 – ESP-NOW Web Server Sensor Dashboard (ESP-NOW + Wi-Fi)” works perfectly if one makes two corrections.
1. In the receiver sketch, change line “#include “ESPAsyncWebServer.h” to “…ESPAsyncWebSrv.h”, both in github and e-Book sketches. I tried many times unsuccessfully to use “ESPAsyncWebServer.h” and it would never compile. I tried different Arduino Library entries and it still wouldn’t complie. I finally notice in some other reference that “ESPAsyncWebServer.h” should be “ESPAsyncWebSrv.h”. After this change, it compiled.
2. In the sender sketch, line 123 (in github) and e-Book, needs to be moved to before loop() and before setup() as Sara noted in one of my previous threads.
After these changes this project worked perfectly.
Hi.
Thanks for pointing that out.
However, I don’t understand the issue with the library. I never had issues referencing the web server libraries that way…
What error did you get when using the previous library reference?
Regards,
Sara
Sara,
When I tried to compile the GitHub version of the receiver sketch, I would get the following error:
C:\Users\xxxxxxxxxx\OneDrive\Documents\Arduino\RecieverMod8Unit5DEMO\RecieverMod8Unit5DEMO.ino:8:10: fatal error: ESPAsyncWebServer.h: No such file or directory
#include “ESPAsyncWebServer.h”
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: ESPAsyncWebServer.h: No such file or directory
GitHub version:
#include <esp_now.h>
#include <WiFi.h>
#include “ESPAsyncWebServer.h”
#include <Arduino_JSON.h>
——————————————————————————————
But when I changed “ESPAsyncWebServer.h” to “ESPAsyncWebSrv.h“, it compiled and loaded.
I really don’t know what to say except my library used “ESPAsyncWebSrv.h” instead of “ESPAsyncWebServer.h”. What happened here?
Gayland
Hi.
To be honest, I’m not sure, I never faced a similar problem and that’s the first time I see someone with that kind of issue.
How did you install the library? Are you using Arduino IDE or VS Code + PIO?
Regards,
Sara
Sara,
I’m using Arduino IDE version 2.0.4 and searched GitHub for the ESPAsyncWebServer.h when it compiled giving me the error. I first started using this new version of Arduino IDL and thought the Library should contain this “.h”. But I kept getting this compile error so I put every link I could find into my Perferences block to populate my library with the correct “.h”. And when this didn’t seem to work, I began looking around and found that I should probably be using …WebSrv.h instead of the …WebServer.h. And it worked.
Do you use …WebServer.h or …WebSrv.h? Have you tried …WebSrv.h?
Gayland
No.
I haven’t tried those.
I use the libraries I mention in the projects.
Regards,
Sara
Sara,
I searched for the library reference that you put in the e-book and then tried compiling the sketch again using “ESPAsyncWebServer.h”. This time it did compile and load into the ESP32. The sketch is now working as designed. I must have loaded my libraries the wrong way and didn’t pick up the correct .h (ESPAsyncWebServer.h).
I believe the “ESPAsyncWebSrv.h” library reference came from “ESPAsyncWebSrv.h by dvarrel”. It seemed to work in my case. However, the mystery seems to be solved.
Thank you so much for helping me in this matter. Your lessons and projects are the best.
Gayland