I recently started with MicroPython on an ESP8266 and am a bit stuck right now.
My goal is to have the WebRepl running in background to easily update my code, while a worker loop is running in main.py.
(The worker loop is reading an analog value and conditionally posting to MQTT -- but I removed this functionality for debugging reasons, so this an be ignored for now.)
The problem I have is that although I can connect to the WebRepl, I can not type in anything, but uploading files is working fine.
It is definitely not a browser issue because I tried multiple browsers and computers. Only when removing the "while True" loop, the Repl works as expected.
Now I tried to use asyncio Task or machine.lightsleep() -- nothing changed.
Can you please help me out how I can run a loop in parallel to WebRepl? Thanks a lot!
main.py to reproduce on ESP8266 with MicroPython 1.11:
Code: Select all
import machine
from utime import sleep
import webrepl
webrepl.start(password='1234')
while True:
#tried without success: machine.lightsleep(1000)
sleep(1)