Code: Select all
# main.py -- put your code here!
from network import WLAN
import time
ssid = 'xxxxx'
auth = (WLAN.WPA2, 'xxxxxxxx')
wlan=WLAN(mode=WLAN.STA)
wlan.antenna(WLAN.EXT_ANT)
wlan.connect(ssid=ssid, auth=auth, timeout=30000)
secs = 0
while (not wlan.isconnected() and secs < 30):
time.sleep(1)
secs += 1
if secs == 30:
wlan.init(mode=WLAN.AP, ssid='wipy-wlan', auth=(WLAN.WPA2,'www.wipy.io'), channel=7, antenna=WLAN.EXT_ANT)
else:
execfile('thingspeak.py')