Shift Registers are a type of Integrated Circuit (IC) or chip. The Shift Register is a serial to parallel convertor that allows us to control eight additional output pins with just three on the Arduino. You can link them together to give you even more (unlimited) outputs!
A Shift Register works by clocking in the data and then locking (or latching) it. This is achieved by setting the data pin to high or low and then pulsing the clock. This is repeated until you have shifted out eight bits of data and set all the pins. Now you can pulse the latch and all eight bits are output to their representative pins.
Quick Facts about the 74HC959N
Here it is in action
It’s possible to achieve the same effect without using the shiftout function. The following code uses a bit shift to pass values into the chip one at a time.
It is possible to control the shift register one bit or output at a time and this would be useful when output pins were at a premium due to the complexity of your design.
In this example we are switching on each LED before turning it off again. Notice how there are now only eight pins.