Code: Select all
>>> import network
>>> ap=network.WLAN(network.AP_IF)
>>> ap.active(False)
>>> st=network.WLAN(network.STA_IF)
>>> st.active(True)
>>> st.isconnected()
False
>>> st.connect("red","red")
>>> import time
>>> while not st.isconnected():
... print(".",end="")
... time.sleep(1)
...
...
...
.................................................................................Traceback (most recent call last):
File "<stdin>", line 3, in <module>
KeyboardInterrupt:
>>> st.disconnect() # not needed, just connecting again would work.
>>> st.connect("red","red")
>>> while not st.isconnected():
... print(".",end="")
... time.sleep(1)
...
...
...
>>> st.isconnected()
True
Calling connect(), waiting 5 seconds, then disconnecting() and/or connect() again also seems to work.