Wi-Fi ===================== .. contents:: Table of Contents :local: :depth: 2 Overview -------- Introduction to the basic usage of Wi-Fi functionality. Wi-Fi Operating Modes --------------------- mPython Core 2.0 supports 2.4 GHz Wi-Fi 1. Station mode (STA) - Connect to a wireless access point (AP) 2. SoftAP mode - Act as an access point for other devices to connect Station Mode ------------ .. image:: /_static/products/ledong-v2/_static/image/example/wifi/wifi.png :width: 70% :align: center .. literalinclude:: /_static/products/ledong-v2/_static/examples/network/wifi.py :caption: Station mode :name: Station mode SoftAP Hotspot Mode ------------------- .. image:: /_static/products/ledong-v2/_static/image/example/wifi/ap.png :width: 70% :align: center .. literalinclude:: /_static/products/ledong-v2/_static/examples/network/ap.py :caption: SoftAP hotspot mode :name: SoftAP hotspot mode API Reference ------------- Main Wi-Fi API ~~~~~~~~~~~~~~ - ``wifi.connectWiFi("ssid, "psd")`` - Connect to Wi-Fi - ``wifi.disconnectWiFi()`` - Disconnect - ``wifi.sta.isconnected()`` - Check if connection is successful - ``wifi.sta.ifconfig()`` - Get Wi-Fi configuration - ``wifi.enable_APWiFi('ssid', 'psd', channel=)`` - Enable SoftAP mode - ``wifi.disable_APWiFi()`` - Disable SoftAP mode FAQ --- Q: Unable to connect to AP - Check if SSID and password are correct - Check if Wi-Fi is on the 2.4 GHz band - Check router settings - Check signal strength Q: SoftAP cannot be discovered - Check if the correct channel is set - Check if the maximum connection count is set reasonably