Controlling digital outputs with the wiring-x86 library

One of the great advantages of working with Python as our programming language to interact with the board is that we have plenty of packages available for Python. We have been using the mraa library to interact with the digital outputs. However, in the previous chapter, we also installed the wiring-x86 library. We can change just a few lines of our object-oriented code to replace the mraa library with the wiring-x86 one to turn on and off the LEDs.

The following lines shows the code for a Board class followed by the new version of the Led class that works with the wiring-x86 library instead of using mraa. The code file for the sample is iot_python_chapter_03_07.py.

from wiringx86 import GPIOGalileoGen2 ...

Get Internet of Things with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.