Shows how to use M2Mqtt library with Azure IoT measuring a BMP280 sensor. This leverages the nanoFramework.IoT.Device repository.
An hardware device with networking capabilities running a nanoFramework image. This code has been tested with ESP32 boards. Note that there is a specific section to enable serial port logging. This can be replaced by any other board with networking capabilities.
The sample uses wifi, this part can be as well replaced with an ethernet connection. It will work the exact same way.
- nanoFramework.IoT.Device Bmxx80 devices.
- Azure IoT documentation for MQTT.
- nanoFramework Network helpers.
- More elements about Azure MQTT connection for nanoFramework.
- Simply adjust the device IoT Hub elements and your network.
- Start Microsoft Visual Studio 2019 by opening the solution.
- Make sure you have your ESP32 showing up in the Device Explorer window.
- Press Ctrl+Shift+B, or select Build > Build Solution.
Important: You can debug this sample only for one cycle as the device will very quickly go to sleep. If you want to debug, comment the part where it goes to sleep and replace with and infinite thread sleep timeout or a loop to once of the previous part of the code.