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!
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 in Elegoo's Super Complete Starter Kit.
Eight 330 Ohm resistors
One 74HC595N LED driver
Eight LEDs, any color you want
Jumper cables, breadboard, cobbler
We will also be using the
PiShiftPy
library, available on pip:sudo pip install PiShiftPy