Add boot file
This commit is contained in:
parent
cb3a7f9036
commit
361cb37fe3
|
@ -0,0 +1,23 @@
|
|||
# This file is executed on every boot (including wake-boot from deepsleep)
|
||||
import esp
|
||||
esp.osdebug(None)
|
||||
|
||||
import network
|
||||
import json
|
||||
|
||||
with open("config.json", 'r') as f:
|
||||
config = json.load(f)
|
||||
|
||||
print(config)
|
||||
|
||||
sta_if = network.WLAN(network.STA_IF)
|
||||
if not sta_if.isconnected():
|
||||
print('connecting to network...')
|
||||
sta_if.active(True)
|
||||
sta_if.connect(config["wifi"]["ssid"], config["wifi"]["password"])
|
||||
|
||||
while not sta_if.isconnected():
|
||||
pass
|
||||
|
||||
print('network config:', sta_if.ifconfig())
|
||||
|
Loading…
Reference in New Issue