mirror of
https://github.com/eliasrenman/gardentron.git
synced 2026-03-17 04:56:06 +01:00
feat: added file upload
This commit is contained in:
22
pico-w/src/boot.py
Normal file
22
pico-w/src/boot.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import network
|
||||
import time
|
||||
from config import ssid, password
|
||||
|
||||
wlan = network.WLAN(network.STA_IF)
|
||||
wlan.active(True)
|
||||
wlan.connect(ssid, password)
|
||||
|
||||
max_wait = 10
|
||||
while max_wait > 0:
|
||||
if wlan.status() < 0 or wlan.status() >= 3:
|
||||
break
|
||||
max_wait -= 1
|
||||
print('Attempting to connect to Wifi...')
|
||||
time.sleep(1)
|
||||
|
||||
if wlan.status() != 3:
|
||||
raise RuntimeError('Wifi connection failed')
|
||||
else:
|
||||
print('Wifi connection established')
|
||||
status = wlan.ifconfig()
|
||||
print('ip:' + status[0])
|
||||
Reference in New Issue
Block a user