Code: Select all
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal
from network import WLAN
wifi = WLAN(mode=WLAN.STA)
nets = wifi.scan()
for net in nets:
if net.ssid.lower() == 'ssid1':
wifi.connect(net.ssid, auth=(net.auth, 'passwd'))
break
elif net.ssid.lower() == 'ssid2':
wifi.connect(net.ssid, auth=(net.auth, 'passwd2')
break
I've tried changing line endings to CRLF (Win) and to LF (Unix), but w/o any success.
Also tried with:
Code: Select all
wifi.connect(ssid=net.ssid, auth=(net.auth, 'passwd')
Ideas?