wifiCfg
Use APIs from the wifiCfg module to configure device WiFi connection.
wifiCfg.autoConnect(lcdShow=True)
- Automatically connect to the saved WiFi networks, displaying connection UI on the screen.
wifiCfg.doConnect(ssid, pwd)
- Connect to the specified WiFi network.
wifiCfg.connect(ssid, pwd, timeout, block=False)
- Connect to the specified WiFi network with a specified connection timeout.
wifiCfg.reconnect()
wifiCfg.wlan_sta.isconnected()
- Check if already connected.
wifiCfg.wlan_sta.ifconfig()
- View connection information.
Example
import wifiCfg
import time
print("start connect")
wifiCfg.doConnect('ssid', 'password')
while True:
if not (wifiCfg.wlan_sta.isconnected()):
print("try reconnect")
wifiCfg.reconnect()
print("get ifconfig")
print(wifiCfg.wlan_sta.ifconfig())
wait(5)