Preparing the MQTT integration

Before we integrate the MQTT code into our sketch, we first need to check our MQTT connection by following these steps:

  1. Please open the mqtt_shiftr_send_receive_example example, which you will find in the general | arduino folder inside the downloaded source code repository. 

The example, as well as all other MQTT code running on the Arduino MKR WiFi 1010,  depends on two libraries:

    • WiFiNINA: This provides network functionality to the Arduino MKR WiFi 1010.
    • MQTT (by Joel Gaehwiler): This enables your Arduino to communicate with other devices and servers via MQTT.

You should have these installed already. If not, install them via the Arduino Library Manager. I am using WiFiNINA v1.30 and MQTT v2.4.3.

Get Hands-On Internet of Things with MQTT now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.