H4T:
Since this daisy chaining thing is turning out to be more complicated than I need it to be, I may just end up putting in two ATMega328s and having them pass data over I2C. Just really wish these boards were a little more friendly for non-EEs.
No need to daisychain the 2 Bobs, just wire them in parallel except for the LATCH signals. Let each have it's own pin. Now send out the data as you would have to either Bob but use the proper pin for the LATCH signal. That's it. About as easy as doing just 1 ring.
Here’s a snippet from the example code.
// Now we just need to write to the shift registers. We have to
// control latch manually, but shiftOut16 will take care of
// everything else.
digitalWrite(latchPin, LOW); // first send latch low
shiftOut16(ledOutput); // send the ledOutput value to shiftOut16
digitalWrite(latchPin, HIGH); // send latch high to indicate data is done sending
Assuming you use 2 different variables to hold the LED states for each ring, the above portion might then look like …
// Now we just need to write to the shift registers. We have to
// control latch manually, but shiftOut16 will take care of
// everything else.
digitalWrite(latchPin1, LOW); // first send latch low for ring1
shiftOut16(ledOutput1); // send the ledOutput value to shiftOut16
digitalWrite(latchPin1, HIGH); // send latch high to indicate data is done sending
// Now repeat for ring2.
digitalWrite(latchPin2, LOW); // send latch low for ring2
shiftOut16(ledOutput2); // send the ledOutput value to shiftOut16
digitalWrite(latchPin2, HIGH); // send latch high to indicate data is done sending
Of course you’ll have to declare and initialize 2 latch pins now but the shifting routine used above remains unchanged.
// This function'll call shiftOut (a pre-defined Arduino function)
// twice to shift 16 bits out. Latch is not controlled here, so you
// must do it before this function is called.
// data is sent 8 bits at a time, MSB first.
void shiftOut16(uint16_t data)
{
byte datamsb;
byte datalsb;
// Isolate the MSB and LSB
datamsb = (data&0xFF00)>>8; // mask out the MSB and shift it right 8 bits
datalsb = data & 0xFF; // Mask out the LSB
// First shift out the MSB, MSB first.
shiftOut(datPin, clkPin, MSBFIRST, datamsb);
// Then shift out the LSB
shiftOut(datPin, clkPin, MSBFIRST, datalsb);
}