24 lines
603 B
Python
24 lines
603 B
Python
# Connection Settings for UB_Devices
|
|
# - Oliver Kennedy okennedy@buffalo.edu
|
|
|
|
# Based on...
|
|
# https://www.buffalo.edu/ubit/service-guides/connecting/resnet/boost-gaming.html
|
|
|
|
import network
|
|
import ntptime
|
|
from time import sleep
|
|
|
|
def connect():
|
|
nic = network.WLAN(network.STA_IF)
|
|
nic.active(True)
|
|
while not nic.isconnected():
|
|
print("Connecting to wifi...")
|
|
nic.connect('UB_Devices', 'goubbulls')
|
|
for i in range(1, 10):
|
|
if nic.isconnected():
|
|
break
|
|
sleep(1)
|
|
if not nic.isconnected():
|
|
print("Connection failed. Sleeping.")
|
|
sleep(5)
|
|
ntptime.settime() |