Chapter 6. Using Python to Drive Hardware

In this chapter, we will cover the following topics:

  • Controlling an LED
  • Responding to a button
  • A controlled shutdown button
  • The GPIO keypad input
  • Multiplexed color LEDs
  • Writing messages using Persistence of Vision

Introduction

One of the key features of a Raspberry Pi computer that sets it apart from most other home/office computers is that it has the ability to directly interface with other hardware. The hardware General Purpose Input/Output (GPIO) pins on the Raspberry Pi can control a wide range of low-level electronics, from Light Emitting Diodes (LEDs) to switches, sensors, motors, servos, and even extra displays.

This chapter will focus on connecting the Raspberry Pi with some simple circuits and getting ...

Get Raspberry Pi for Python Programmers Cookbook - Second Edition 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.