8.28. network 模块 API 文档
8.28.1. API
8.28.1.1. class LAN(_network.LAN):
def __init__(self,interface_id:int):...
def active(self,is_active=None):...
def status(self,param=None):...
def isconnected(self)->int:...
def config(self,*para,**kwargs):...
def ifconfig(self,config=None):...
8.28.1.2. class WLAN(_network.WLAN):
def __init__(self,interface_id:int):...
def active(self,is_active=None):...
def connect(self,ssid=None,key=None,bssid=None):...
def disconnect(self):...
def status(self,param=None):...
def isconnected(self)->int:...
def config(self,*para,**kwargs):...
def ifconfig(self,config=None):...
def scan(self):...
def isconnected():...
8.28.2. Examples
8.28.2.1. network_config.py
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('testssid', 'testpassword')
wlan.config(ssid='configssid', channel=11)
print(wlan.config('ssid'), wlan.config('channel'))
wlan.close()
8.28.2.2. network_connect.py
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('testssid', 'testpassword')
wlan.isconnected()
wlan.close()
8.28.2.3. network_scan.py
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.scan()
wlan.close()