Book Image

Python Programming for Arduino

Book Image

Python Programming for Arduino

Overview of this book

Table of Contents (18 chapters)
Python Programming for Arduino
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Stage 1 – prototyping the thermostat


In this prototyping stage, we will develop the Arduino and Python code for our thermostat, which will be later used in the second stage with minor changes. Before you start the coding exercise, make sure that you have the thermostat sensor unit ready with the Arduino board and the connected sensors, as described in the previous section. For this stage, you will be using your regular computer which is equipped with the Arduino IDE and the Python programming environment. The prototyping stage requires two levels of programming, the Arduino sketch for the thermostat sensor unit and the Python code for the computational unit. Let's get started with coding for our thermostat.

The Arduino sketch for the thermostat

The goal of this Arduino program is to interface sensors, get measurements from the sensors, and print them on the serial port. As we discussed earlier, rather than using the standard Firmata sketch that we used in the previous project, we are going...