Thank you. That code is something worth checking out, and btw, the idea of making a word clock is awesome so thanks for that too. 
Well, it could be that it shifted 16 bits (who knows) but with that library's numberOfShiftRegisters
set to 3
, you'd imagine that it would work properly - or at least not in the way it did.
I also tested it with a different piece of code, which I found on the forums, and I didn't have any luck there either: the third IC's first LED-connected pin acted exactly like the first IC's first LED-connected pin.
Code was as follows:
// Found: https://forum.arduino.cc/t/im-having-trouble-daisy-chaining-two-shift-registers-together-and-executing-a-s/263283/2
int datapin = 2;
int clockpin = 3;
int latchpin = 4;
unsigned long data[18]= {
0b11111111111111111,
0b01111111111111111,
0b00111111111111111,
0b00011111111111111,
0b00001111111111111,
0b00000111111111111,
0b00000011111111111,
0b00000001111111111,
0b00000000111111111,
0b00000000011111111,
0b00000000001111111,
0b00000000000111111,
0b00000000000011111,
0b00000000000001111,
0b00000000000000111,
0b00000000000000011,
0b00000000000000001,
0b00000000000000000
};
void setup()
{
pinMode(datapin, OUTPUT);
pinMode(clockpin, OUTPUT);
pinMode(latchpin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
manyOnAtATime(); // Scroll down the line
}
void shiftWrite(unsigned int desiredPins)
{
shiftOut(datapin, clockpin, MSBFIRST, highByte(desiredPins));
shiftOut(datapin, clockpin, MSBFIRST, lowByte(desiredPins));
digitalWrite(latchpin, HIGH);
digitalWrite(latchpin, LOW);
}
void manyOnAtATime()
{
int i;
int delayTime = 1000;
for (i = 0; i < 17; i++) // Note: I also tried i < 18 to no avail -- Mark
{
shiftWrite(data[i]); // turn LEDs on
delay(delayTime); // pause to slow down the sequence
Serial.print("i: ");
Serial.print(i);
Serial.print( ", data[");
Serial.print(i);
Serial.print("]: ");
Serial.print(data[i]);
Serial.println(".");
}
}
Just a little anekdote: I've been a Linux system administrator for close to 23 years. In my teens I worked at a computer shop where people would often bring their computer with the old "it doesn't work." They'd report all kinds of erratic problems. But when we connected them in our shop and tested it inside and out, often we could not find any problem. So then the question we asked the customer was, "is your computer power connection at home grounded (earth wire)?" In many many cases it was not. So when they tried a different wire, for example from the kitchen where ground wires are mandatory, their PC would stop acting up.
So, that's why I have no doubt about lack of capacitors causing my problem. This is a house built in the 70s, in a pretty old village. in the house I have LED lightbulbs on a dimmer. Especially at night, they have kind of the same flickering as an old diesel car in the freezing cold. I was told by the power company that this is probably due to a nearby-ish factory's current demands. So we probably have unstable power here that is especially noticeable on these low-voltage projects like LEDs. That's my newbie guess at least.