wifi and internet connection
Posted: Mon May 10, 2021 7:10 pm
hello there! useless to say I'm pretty new to MicroPython: my questions speak for themselves...
I set a ESP8266 D1 pro to scan and test functionality of few wifi AP's in the building.
I need to test both wifi connection and internet availability in separate way .
Basically the system works except the following:
if I disconnect the internet cable from the AP while its wifi is active, the sta_if routine says that wifi is not available; on the other hand, sta_if.scan() shows the wifi ssid.
I'm sure I'm wrong somewhere but: where?
thanks
sauro
I set a ESP8266 D1 pro to scan and test functionality of few wifi AP's in the building.
I need to test both wifi connection and internet availability in separate way .
Basically the system works except the following:
Code: Select all
oldtime = utime.ticks_ms()
station.active(True)
station.connect(SSID, PW)
try:
while not station.isconnected():
p2.off()
lapse = utime.ticks_diff(utime.ticks_ms(), oldtime)/1000
if lapse > 20:
raise Exception("niente WiFi")
continue
if station.isconnected():
lista[FLAG+1]="WIFI_SI"
msg1="wifi connesso"
pingo()
except Exception as e:
msg1="niente wifi"
lista[FLAG+1]="WIFI_NO"
pingo()
station.disconnect()
p2.on()
I'm sure I'm wrong somewhere but: where?
thanks
sauro