首先打开 boot.py 文件,配置 Wifi 通道的区域:
import pyb pyb.country('CN') # 2-char code, eg: US, GB, DE, NL, FR, AU, CA Wifi Station import network wl = network.WLAN() wl.active(1) # bring up the interface wl.config('mac') # get the MAC address wl.config(antenna=0) # select antenna, 0=chip, 1=external wl.scan() # scan for access points, returning a list wl.connect('ssid', 'password') # connect to an access point wl.isconnected() # check if connected to an access point wl.disconnect() # disconnect from an access point