Programming with MicroPython: WiFi & IoT
Import FutureBoard Library
Import the Library to make use of its functions.
07: WiFi & IoT
1. Connect to WiFi
FutureBoard can only connect to wireless networks with 2.4GHz frequency.
2. Get the Connection Status
Returns 1 if FutureBoard is connected to the network, 0 if not.
3. Get the Connection Configuration
Returns a list with the configuration including IP Address, Subnet Mask, Gateway, Domain.
4. Get the MAC Address
Returns the physical address of the FutureBoard.
5. File Download
Downloads a file from a file URL and saves it to the SD card.
Sample Program 1~4
Import MQTT Library
MQTT operations require the mqttsimple library.
5. Set up an MQTT object
Creates an object with the connection to the MQTT Broker.
For most brokers, insert the host address into server and the client id into client_id.
For some brokers, please refer to the broker’s documentations for the details required to connect to the server.
6. Connect to the MQTT Server
7. Disconnect the MQTT Server
8. Subscribe to a MQTT Topic
Fill in the topic name according to the documentation of the MQTT Broker.
9. Publish a Message to a MQTT Topic
Fill in the message and topic name according to the documentation of the MQTT Broker.
10. Read the Message from the MQTT Topic
Fill in the topic name according to the documentation of the MQTT Broker.
11. Read the Last Message of the MQTT Topic
12. Wait until a MQTT Message is Published
13. Define MQTT Event Trigger Function
Sample Program 1
Sample Program 2
urequests and ujson Libraries
urequests and ujson libraries are also available to use. Please visit their official documentation for details.
Import urequests and ujson Libraries
Last updated