Reader small image

You're reading from  Practical Python Programming for IoT

Product typeBook
Published inNov 2020
Reading LevelIntermediate
PublisherPackt
ISBN-139781838982461
Edition1st Edition
Languages
Right arrow

Understanding the code

As we discuss the code found in chapter04/mqtt_led.py, pay particular attention to how the code connects to the MQTT broker and manages the connection life cycle. Furthermore, as we cover how the code receives and processes messages, try to relate the code workflow back to the command-line examples that we used to publish the message in the previous subsection, Running the LED MQTT example.

Once you have an understanding of our Python code and how it integrates with our MQTT broker, you'll have an end-to-end working reference solution built around MQTT messaging that you can adapt for your own needs and projects.

We will start by looking at the imports. As usual, we will skip over any common code that we have already covered in previous chapters, including logging setup and GPIOZero-related code.

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Practical Python Programming for IoT
Published in: Nov 2020Publisher: PacktISBN-13: 9781838982461