O'Reilly logo

Internet of Things with Python by Gastón 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

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 ...

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