O'Reilly logo

Hands-On MQTT Programming with Python by Gaston C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Coding a surfboard sensor emulator

First, we will create a CSV file with many status, speed in mph, altitude in feet, and temperature in degrees Fahrenheit values separated by commas. Each line in the file will represent a set of values that the surfboard sensor emulator will publish to the appropriate topics. In this case, it is not convenient to work with random values because we want to emulate real-life scenarios for a surfer and his surfboard.

Now, we will create a new file named surfboard_sensors_data.csv in the main virtual environment folder. The following lines show the code that defines the data retrieved from a short surfing session for the surfer and their surfboard.

The values separated with commas from left to right are the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required