If our project needs to control 32 LEDs, we would normally require 32 pins of a microcontroller (MCU). The problem is that every MCU has a limited number of pins for GPIO. To address this issue, we can extend our MCU GPIO pins.
One of the solutions to extend GPIO pins is to use a shift register. We can use 74HC595 to extend the GPIO output pins. If you want to extend the GPIO input pins, you can use 74HC165. The schema of 74HC595 can be seen in the following figure:
The Q0 to Q7 pins are the parallel output from the chip. The DS pin is the serial data. STCP is the latch pin, and SHCP is the clock pin.
In this section, ...