ESP8266 conn.py added

pull/7/head
Peter Hinch 2016-09-05 10:41:24 +01:00
rodzic a820755f5d
commit c0ea6bad60
2 zmienionych plików z 25 dodań i 0 usunięć

23
ESP8266/conn.py 100644
Wyświetl plik

@ -0,0 +1,23 @@
# Connect in station mode. Use saved parameters if possible to save flash wear
import network
import utime
use_default = True
ssid = 'my_ssid'
pw = 'my_password'
sta_if = network.WLAN(network.STA_IF)
if use_default:
secs = 5
while secs >= 0 and not sta_if.isconnected():
utime.sleep(1)
secs -= 1
# If can't use default, use specified LAN
if not sta_if.isconnected():
sta_if.active(True)
sta_if.connect(ssid, pw)
while not sta_if.isconnected():
utime.sleep(1)

Wyświetl plik

@ -39,6 +39,8 @@ the same topic. Measures the round-trip delay. Adapt to suit your server address
QOS (quality of service, 0 and 1 are supported). After 100 messages reports maximum and
minimum delays.
conn.py Connect in station mode using saved connection details where possible
## Rotary Incremental Encoder
Classes for handling incremental rotary position encoders. Note that the Pyboard timers can