stepper-clock/boot.py

21 lines
569 B
Python

import network
import webrepl
webrepl.start()
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)
availableNetworkSSIDs = [s[0].decode() for s in sta_if.scan()]
print(availableNetworkSSIDs)
#load wifi credentials from file
with open("wifi-credentials","r") as f:
while True:
ssid = f.readline()
password = f.readline()#
if not ssid or not password:
break
ssid = ssid.replace("\n","")
password = password.replace("\n","")
if ssid in availableNetworkSSIDs:
sta_if.connect(ssid,password)