import pycom import machine import time from network import WLAN print('wifi_sta') pycom.heartbeat(0) pycom.heartbeat(1) pycom.rgbled(0x00ff00) wlan = WLAN(mode=WLAN.STA) nets = wlan.scan() for net in nets: print(str(net.ssid)) if not wlan.isconnected(): wlan.ifconfig(config=('192.168.4.2', '255.255.255.0', '192.168.4.1', '192.168.4.1')) #wlan.connect('wipy-wlan-a8be', auth=(WLAN.WPA2, 'www.wipy.io'), timeout=5000) wlan.connect('wipy-wlan-6ec2', auth=(WLAN.WPA2, 'www.wipy.io'), timeout=5000) while not wlan.isconnected(): time.sleep_ms(10) #pass #machine.idle() # save power while waiting print('WLAN connection succeeded!') pycom.heartbeat(0) pycom.heartbeat(1) pycom.rgbled(0x00ff00)