Users Manual

19/05/2019 Pyboard D-series reference Pyboard D-series 1.0 documentation
https://pybd.io/hw/pybd_sfxw.html 6/8
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
TousetheWiFiaccess‑pointinterface:
import network
wl_ap = network.WLAN(1)
wl_ap.config(essid='PYBD') # set AP SSID
wl_ap.config(password='pybd0123') # set AP password
wl_ap.config(channel=6) # set AP channel
wl_ap.active(1) # enable the AP
wl_ap.status('stations') # get a list of connection stations
wl_ap.active(0) # shut down the AP
See network formoredetails.
Internal LEDs
Seepyb.LED.
from pyb import LED
led = LED(1) # 1=red, 2=green, 3=blue
led.toggle()
led.on()
led.off()
Internal USR button
Seepyb.Switch.
from pyb import Switch
sw = Switch()
sw.value() # returns True or False
sw.callback(lambda: pyb.LED(1).toggle())