Cover by Shawn Wallace, Matt Richardson

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 8. Programming Inputs and Outputs with Python

At the end of Chapter 7, you did a little bit of programming with the Raspberry Pi’s GPIO pins using a shell script. In this chapter, you’re going to learn how to use Python to do the same thing… and a little more. Much like with the shell script, Python will let you access the pins by writing code to read and control the pins automatically.

The advantage that Python has over shell scripting is that the code is easier to write and is more readable. There’s also a whole slew of Python modules that make it easy for you to do some complex stuff with basic code. See Table 3-2 for a list of a few modules that might be useful in your projects. Best of all, there’s a Python module called raspberry-gpio-python ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required