wl.isconnected() timeout possible?
misterlisty last edited by
Just came across a scenario i have never experienced. If i am trying to connect to a wifi ap and it never connects, how do i get it to continue the rest of the code?
from network import WLAN import os import time import machine import pycom # len([item for item in os.listdir() if fname==item])>0 wl = WLAN(mode=WLAN.STA) wl.connect("xer", (WLAN.WPA2, "0996"), timeout=10000) print("_connect_wifi::Connected to with IP address:",wl.ifconfig()) time.sleep(1) while not wl.isconnected(): #it could lock here for ever!!!! machine.idle() # save power while waiting time.sleep(5) print("not connected to wifi yet..") pycom.heartbeat(True) print("_connect_wifi::Connected to with IP s:",wl.ifconfig())
livius last edited by