You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
watersensor/src/wifi.py

16 lines
327 B

4 years ago
import network
def connect():
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print('connecting to network...')
sta_if.active(True)
sta_if.connect('<ssid>', '<psk>')
while not sta_if.isconnected():
pass
print('network config:', sta_if.ifconfig())