-
|
Hello, I can't connect to my WiFi network if i use prepared script - "main.py". It is possible to connect, if I type commands one by one through the Thonny console (ESP-12F as an interpreter ofc). I use Thonny as IDE to save scripts into ESP-12F file system via CH340G serial-USB converter. Firmware: esp8266-20230426-v1.20.0.bin boot.py main.py CONSOLE OUTPUT: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
I'd remove the first: sta.connect("banana", "vExolpDFG")then I'd copy the example in:
Sometimes it is best to start with a: sta.active(False)For a bullet-proof WiFi connect look at: |
Beta Was this translation helpful? Give feedback.
-
|
I would remove the sta.connect() statement in the loop and NOT use machine.lightsleep(). Use time.sleep_me() instead, even if looking at the code of lightsleep() it does not make a difference. |
Beta Was this translation helpful? Give feedback.
-
|
Do not use machine.lightsleep() because it shuts down WiFi. Use time.sleep_ms() instead. |
Beta Was this translation helpful? Give feedback.

I'd remove the first:
then I'd copy the example in:
https://docs.micropython.org/en/latest/esp8266/quickref.html
Sometimes it is best to start with a:
For a bullet-proof WiFi connect look at:
https://github.com/glenn20/micropython-espnow-utils/blob/main/src/wifi.py