Skip to Content
Hands-On Edge Analytics with Azure IoT
book

Hands-On Edge Analytics with Azure IoT

by Colin Dow
May 2020
Intermediate to advanced
262 pages
6h 48m
English
Packt Publishing
Content preview from Hands-On Edge Analytics with Azure IoT

Understanding the edge device code

The main.py file is run after boot.py whenever a MicroPython microcontroller is turned on. In our code, we have a continuous loop that checks the temperature every 60 seconds and compares it to the temperature threshold. If the temperature is too low, the heater is turned on and a cycle counter is incremented. Once the counter reaches the maximum number of cycles, the heater is turned off for 6 hours and a LoRa message is sent out indicating that the heater has been disabled.

The following is a diagram of the main.py file:

Our code reads the value from a temperature sensor using the DHT11 class. The LoRaMessage ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Azure IoT Edge Computing: Extending the Cloud to the Intelligent Edge

Beginning Azure IoT Edge Computing: Extending the Cloud to the Intelligent Edge

David Jensen

Publisher Resources

ISBN: 9781838829902Supplemental Content