#include "LedControl.h"
byte numberDisplay = 8; // how many displays to use
LedControl lc = LedControl(2, 3, 4, numberDisplay); // Pins: DIN,CLK,CS, # of Display connected
void setup()
{
for (byte i = 0; i < numberDisplay; i++) {
lc.shutdown(i, false); // Wake up displays
lc.setIntensity(i, 5); // Set intensity levels
lc.clearDisplay(i); // Clear Displays
}
}
void loop() {
for (byte i = 0; i < numberDisplay; i++) {
for (byte j = 0; j <= 7; j++) {
lc.setColumn(i, j, 255);
}
}
for (byte j = 0; j <= 7; j++) {
for (byte i = 0; i < numberDisplay; i++) {
lc.setRow(i, j, 0);
delay(5);
}
}
for (byte i = 0; i < numberDisplay; i++) {
for (byte j = 0; j <= 7; j++) {
lc.setColumn(7-i, 7-j, 255);
}
}
for (byte j = 0; j <= 7; j++) {
for (byte i = 0; i < numberDisplay; i++) {
lc.setRow(7-i, 7-j, 0);
delay(5);
}
}
}
Mostly a simple fill and wipe loop for checking up to 8 LED dot matrix. I noticed that drawing column seems to take a few cycles longer than drawing row, I had to add delay to row writes to make the whole display seems to run at the same speed.
I guess row writing is one data cycle, but column writing is 8 cycles of updating one LED each rows.
Just my observation. Running off UNO, the column writing lag is probably more noticeable if you used AVR chips at lower clock speed, like ATTiny85 at 8MHz