homecontrol-neopixel/wifi.py

18 lines
458 B
Python
Raw Normal View History

import network
NET_SSID="omnomnom"
NET_PASS="Ne!HabIchNicht!"
class wifi:
def __init__(self):
self.if_ap = network.WLAN(network.AP_IF)
self.if_sta = network.WLAN(network.STA_IF)
def connect(self):
self.if_ap.active(False)
self.if_sta.active(True)
self.if_sta.connect(NET_SSID, NET_PASS)
while not self.if_sta.isconnected():
pass
print("network config: ", self.if_sta.ifconfig())