From 361cb37fe3566e207171a802931b72107220a352 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 8 Jul 2021 23:04:49 +1200 Subject: [PATCH] Add boot file --- boot.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 boot.py diff --git a/boot.py b/boot.py new file mode 100644 index 0000000..ca01be5 --- /dev/null +++ b/boot.py @@ -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()) +