Connecting the 74HC595N shift register to control many LEDs

So far, we've been controlling LEDs with individual GPIO pins. Not only is this a rather inefficient use of the Raspberry Pi Zero GPIO, but even if we used every single available pin for an LED, that would be a pretty boring light show. Instead, by adding in an LED driver such as the inexpensive 74HC595N, you easily get the ability to leverage several LEDs, or multiple 4x7-segment-number displays. In this recipe, we will use the SPI interface to control an eight-LED array. Let's get cooking!

Getting ready

Here is what you'll need for this recipe. At this point, you should be able to improvise with LED options. I used the 74HC595N, which is a commonly available chip online and also included ...

Get Raspberry Pi Zero Cookbook 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.