Wi-Fi ===================== .. contents:: Contents :local: :depth: 2 Overview -------- Introduces the basic usage of its Wi-Fi features. Wi-Fi Working Modes ------------------- The mPython Board 3.0 supports 2.4 GHz Wi-Fi 1. Station mode (STA) - Connects to a wireless access point (AP) 2. SoftAP mode - Acts as an access point for other devices to connect to Station Mode ------------ .. image:: /_static/products/mpython-s3/_static/image/example/wifi/wifi.png :width: 70% :align: center .. literalinclude:: /_static/products/mpython-s3/_static/examples/network/wifi.py :caption: Station mode :name: Station mode SoftAP Hotspot Mode ------------------- .. image:: /_static/products/mpython-s3/_static/image/example/wifi/ap.png :width: 70% :align: center .. literalinclude:: /_static/products/mpython-s3/_static/examples/network/ap.py :caption: SoftAP hotspot mode :name: SoftAP hotspot mode API Reference ------------- Main Wi-Fi APIs ~~~~~~~~~~~~~~~ - ``wifi.connectWiFi("ssid, "psd")`` - Connect to Wi-Fi - ``wifi.disconnectWiFi()`` - Disconnect - ``wifi.sta.isconnected()`` - Check whether the connection succeeded - ``wifi.sta.ifconfig()`` - Get the Wi-Fi configuration - ``wifi.enable_APWiFi('ssid', 'psd', channel=)`` - Enable SoftAP mode - ``wifi.disable_APWiFi()`` - Disable SoftAP mode FAQ --- Q: Unable to connect to the AP - Check whether the SSID and password are correct - Check whether the Wi-Fi network is on the 2.4 GHz band - Check the router settings - Check the signal strength Q: The SoftAP cannot be found in scans - Check whether the correct channel is set - Check whether the maximum number of connections is set reasonably