mirror of
https://github.com/KevinMidboe/ESP-Plant-Logger.git
synced 2025-10-29 17:40:20 +00:00
v0.1 🙆♀️ Chewie, we're home
This commit is contained in:
29
boot.py
Normal file
29
boot.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# This file is executed on every boot (including wake-boot from deepsleep)
|
||||
#import esp
|
||||
#esp.osdebug(None)
|
||||
import uos, machine
|
||||
#uos.dupterm(None, 1) # disable REPL on UART(0)
|
||||
import gc
|
||||
#import webrepl
|
||||
#webrepl.start()
|
||||
gc.collect()
|
||||
|
||||
# - - - NETWORKING - - -
|
||||
import network
|
||||
sta_if = network.WLAN(network.STA_IF)
|
||||
|
||||
def connectWifi():
|
||||
sta_if.active(True)
|
||||
|
||||
# PSID and password for wifi
|
||||
sta_if.connect('', '')
|
||||
return sta_if
|
||||
def disconnectWifi():
|
||||
sta_if.active(False)
|
||||
|
||||
if not sta_if.isconnected():
|
||||
print('connecting to network...')
|
||||
connectWifi()
|
||||
while not sta_if.isconnected():
|
||||
pass
|
||||
print('network config:', sta_if.ifconfig())
|
||||
Reference in New Issue
Block a user