ESP8266 Webserver Project

Moderator: Sprite_tm

User avatar
By emvee
#24570 How can I get the web server to still take GET requests when using a while loop? I am using a while true infinite loop. is there a way to restart the server? or stop it?

Im using the server.on function to call another function which contains a infinite while loop. Is there any way to still accept GET requests? Because it seems the server no longer responds to requests when using a infinite loop or during a loop. I wish i could background this loop somehow.. :?
User avatar
By emvee
#24622
Sprite_tm wrote:
emvee wrote:...the server.on function...

Are you sure you're using esphttpd and not some nodemcu or arduino http server?


Sorry seems I posted this in the wrong section it seems.. I am using the ESP8266webserver. I will try and use esphttpd to see if it solves my issue.
User avatar
By Sprite_tm
#24666 It won't. Esphttpd (as are most if not all) http servers at this moment, is event-driven, meaning no infinite loops. I'd suggest re-writing whatever's in your infinite loop to an event-driven thing (maybe using timers or interrupts?). Maybe you can also get away by starting a thread using the li'l Xtensa OS functions that are there, if you can figure out how to do that safely.