So I just got some shift registers, and was messing around a bit with them and the examples, but I'm really not sure how I can set up my own patters to turn leds on/off. I thought that it used binary to turn on or off each of the 8 leds ( ex. 01000000 = the second led would be on). but that doesn't seem to be it.
I am also not sure how this would work with two, or more shift registers.
One of the projects I have in mind is a clock using 7 segment displays, so I would need probably 5 shift registers, and would like a simple way to give them patters to turn on or off the leds.
Keep the patterns in an array, and shift them out as needed.
I create one array with the "font" for the numbers,
have a 2nd that keeps track of the digits to be displayed,
and every so often write them all out.
if (timeToWrite ==1){
timeToWrite = 0; // reset for next time
// enable updates
digitalWrite(latchPin, LOW);
// send out 5 bytes
for (x=0; x<5; x=x+1){
// double lookup:
// first is the number to display from dataArray,
// second is the font for that number (segments that will be on/off)
SPI.transfer ( fontArray[dataArray[x] ]);
} // next digit
// done writing
digitalWrite(latchPin, HIGH);
} // end time check