Can someone assert that no delay is needed between row scanning?
With a matrix you can only switch on one row at a time. If you switch two rows on at the same time you double the power handling requirements of the shift registers, which could be bad.
With a hardware shift register the switch between rows should be so fast that it doesn't cause any problems. If you're truly paranoid you could put a delay between rows. It doesn't need to be a millisecond, a microsecond is enough (ie. turn all rows off then turn the next row on as fast as the CPU will go...)
Whatever you do, make sure you have good decoupling. Bad decoupling is worse for the hardware than any slight overlap in the row switching.
That's why I was concerned about the delay being so incredibly small that in effect there is none, leading to two rows+ being on at the same time. Thanks for the recommendation - shall do that instead!
Wasn't aware of decoupling. Shall go read up.
Many thanks!
In terms of having it display something for a certain period - how would I go about doing this? This is my code:
void loop() {
grid(255,231,231,129,129,231,231,255);
}
// Various functions
void grid(int a, int b, int c, int d, int e, int f, int g, int h) {
shift(1, a);
shift(2, b);
shift(4, c);
shift(8, d);
shift(16, e);
shift(32, f);
shift(64, g);
shift(128, h);
}
void shift(int r, int c) {
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, r);
shiftOut(dataPin, clockPin, MSBFIRST, c);
digitalWrite(latchPin, HIGH);
}
Now this works absolutely fine. But say I wanted it to remain on for 500ms, then display nothing -grid(0,0,0,0,0,0,0,0)-, for 500ms, how would I do this?
Many thanks!