You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.4 KiB

# This file is executed on every boot (including wake-boot from deepsleep)
import webrepl
import time
import machine
wifi_timelimit = 5.0
from secrets import secrets
yourWifiSSID = secrets["ssid"]
yourWifiPassword = secrets["password"]
except ImportError:
print("WiFi secrets are kept in, please add them there!")
def connect():
import network
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print('connecting to network...')
sta_if.connect(yourWifiSSID, yourWifiPassword)
print("connecting to " + yourWifiSSID + "...")
start = time.time()
while not sta_if.isconnected():
if time.time() - start > wifi_timelimit:
print(" ")
print("**** TIMEOUT: too long a wait for connecting to WiFi - check ssid and password")
print(" ")
ipaddress = sta_if.ifconfig()[0]
print("connected to " + yourWifiSSID + ' with IP address:' , ipaddress)
def no_debug():
import esp
esp.osdebug(None) # this can be run from the REPL as well
def showip():
import network
sta_if = network.WLAN(network.STA_IF)
print('network config:', sta_if.ifconfig())
import main