Hi,
I have tried the MicroPython ESP Web Server, but it seems to get stuck already with one client.
For ESP8266/Arduino there seems to be a much better async web server, but nothing for ESP8266/Microphyton?
(What I want to do is a model-lighthouse server, with ability to set light-characteristics from a simple webpage, but I can’t get the code blink the LED at the same time as handling the webserver, and only one client, I need something more powerful)
Thsi is the tutorial I’m following:
https://randomnerdtutorials.com/esp32-esp8266-micropython-web-server/
Any suggestions?
Kind regards
Niclas
Hi.
What do you mean that the web server gets stuck?
For “multitasking”, you may want to take a look at this (I haven’t tried it):
- https://docs.micropython.org/en/v1.15/library/uasyncio.html
- https://forum.micropython.org/viewtopic.php?t=4067
Have you taken a look at picoweb?:
- https://techtutorialsx.com/2017/09/01/esp32-micropython-http-webserver-with-picoweb/
I haven’t tried it, but it is an alternative way to build web servers with micropython.
Regards,
Sara
Hi,
Since english not is my native language, I maybe not that clear, but I’ll give it another try.
What I mean is that following your tutorial (which normally is a very good path to get started) I can get the ESP8266 presenting a web-page, with a choice of LED on/off, which I extended to a four-button panel. So far everything works, but as soon as I try to get the LED blinking instead it seems like the webserver takes all resources. Switching a LED on and off is done in microseconds but to get the LED blinking a special sequence seems not doable, since the webserver appears to be single threaded and blocks the processor from doing other stuff.
What I think I need is a multithreaded and/or asynchronos webserver which let me handle more than one client and do other things in the background. This seems however much more complicated so I just wondered if you, or someone in the forum, has experience with a little more powerful, but still easy to use, webserver for micropython on ESP8266.
I’ll check your suggestions, but maybe someone have more ideas?
Kind regards
Niclas
Hi.
Thanks for clarifying. It is clear now.
To have multithreaded you need to use the async scheduler methods: https://docs.micropython.org/en/v1.15/library/uasyncio.html
You can create different tasks that run on their own time. Unfortunately, I’m not familiar with those micropython methods. But, that’s where you should start searching.
Regards,
Sara