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

Getting started with pySerial


You learned about the Firmata protocol in the previous section. This is an easy and quick way to start working with Arduino. Although the Firmata protocol helps you to develop complex applications from your computer without modifying the Arduino sketch, we are not ready to start coding these applications.

The first step towards writing these complex applications is to provide an interface between your programming environment and the Arduino via a serial port. In this book, you will be required to establish a connection between the Python interpreter and Arduino for every project that we develop.

Writing your own library, which includes implementation of functions and specifications to enable communication on a serial protocol, is an inconvenient and time consuming process. We are going to avoid that by using an open source, well maintained Python library called pySerial.

The pySerial library enables communication with Arduino by encapsulating the access for the...