Quantcast
Viewing all articles
Browse latest Browse all 4922

MicroPython • Re: Pico W Reliability

Modified version of connect_to_wifi() behaves better:

Code:

async def connect_to_wifi():    wlan = network.WLAN(network.STA_IF)    wlan.config(trace=1)    wlan.config(pm=network.WLAN.PM_NONE)    wlan.active(True)#    wlan.connect(ssid, password)#    while not wlan.isconnected():#         pico_led.blink()#        print("Waiting for connection...")#        await uasyncio.sleep(1)    while not wlan.isconnected():        wlan.connect(ssid, password)        print("Trying to connect...")        for i in range(5):            if wlan.isconnected(): break            pico_led.blink()            print("Waiting for connection %i s"%i)            await uasyncio.sleep(1)    print("Connected:", wlan.ifconfig())    pico_led.on()    return wlan

Statistics: Posted by gmx — Wed Dec 25, 2024 11:31 pm



Viewing all articles
Browse latest Browse all 4922

Trending Articles