Bridging pySerial and Firmata
In the Firmata section, we already learned how useful it is to use the Firmata protocol instead of constantly modifying the Arduino sketch and uploading it for simple programs. pySerial
is a simple library that provides a bridge between Arduino and Python via a serial port, but it lacks any support for the Firmata protocol. As mentioned earlier, the biggest benefit of Python can be described in one sentence, "There is a library for that." So, there exists a Python library called pyFirmata
that is built on pySerial
to support the Firmata protocol. There are a few other Python libraries that also support Firmata, but we will only be focusing on pyFirmata
in this chapter. We will be extensively using this library for various upcoming projects as well:
- Let's start by installing
pyFirmata
just like any other Python package by using Setuptools:$ sudo pin install pyfirmata
In the previous section, while testing
pySerial
, we uploaded theDigitalSerialRead...