Code:
... wlan = network.WLAN(network.STA_IF)wlan.active(True)wlan.connect(SSID,password)time.sleep(2)max_wait = 10while max_wait > 0: if wlan.status() < 0 or wlan.status() >= 3: break max_wait -= 1.... When running this on thonny, the wifi chip has some time to settle between power up and start (manually) than when running from a wall adapter. So adding some more delay could be needed.
As you see the LED blink signals when running from a wall adapter, another obvious error can be excluded: the code file should be named main.py on pico.
What you could add to the code to improve error tracing is a 'log to file' feature.
Example, untested:
Code:
import timedef log_to_file(message:str): print(message) with open("logfile.dat", "at") as f: f.write( f"{time.time():} {message}" + "\n");log_to_file("this is a test")Statistics: Posted by ghp — Thu Apr 25, 2024 5:44 am