Programming Logic (Shift Registers)

With daisy-chained shift registers you have to send data to all of them every time you update. Typically you use a variable (an array) to hold the current state, and shift that out after a change.

Another way to do it would be to loop round the output from the last register back to another (INPUT) pin - then you can avoid having to copy the state of the registers in variables, but that's somewhat more complex and more fragile.

If the registers are latched (such as 74HC595) you only clock the latch pin after updating all the registers (to avoid glitches on the unchanged outputs).