I have 2 rows of 12 MAX7219 connected in series with DOUT to DIN (rows are isolated). Now the thing is I am using LedControl
Library to work with it. The problem is the last 4 Matrices on both the rows don't work. The sequence in my code is like this where (row, column, matrix)
is used to define the row and column of the matrix and I am talking about a single ROW from two ROWs of 12.
Sequence in Code What Happens
---------------- -----------------
(0, 1, 0) (0, 1, 0)
(0, 1, 1) (0, 1, 9)
(0, 1, 2) (0, 1, 1)
(0, 1, 3) (0, 1, 10)
(0, 1, 4) (0, 1, 2)
(0, 1, 5) (0, 1, 11)
(0, 1, 6) (0, 1, 3)
. .
. .
. .
(0, 1, 11) (0, 1, 8)
Now I can understand why does this happens. This code works like this even if the Device Count
is 8.
Code:
#include "LedControl.h"
LedControl row1=LedControl(2,4,3,12);
LedControl row2=LedControl(5,7,6,12);
unsigned long delaytime=500;
void setup() {
int d_row1 =row1.getDeviceCount();
for(int address=0;address<d_row1;address++) {
row1.shutdown(address,false);
row1.setIntensity(address,15);
row1.clearDisplay(address);
}
int d_row2 =row2.getDeviceCount();
for(int address=0;address<d_row2;address++) {
row2.shutdown(address,false);
row2.setIntensity(address,15);
row2.clearDisplay(address);
}
}
void loop() {
int devices=row1.getDeviceCount();
for (int i = 0; i < devices; i++){
delay(delaytime);
row1.setLed(i,0,0,true);
row2.setLed(i,0,0,true);
delay(delaytime);
row1.setLed(i,0,0,false);
row2.setLed(i,0,0,false);
}
}
EDIT I just noticed something, there is no data going to the last 4 matrices. The timings of the blinking of the LEDs on last 4 matrices does not ties correctly (500ms) but it is in fact 250ms (i.e. half time). It means the blinks on last 4 matrices are between pulses of the first 4 matrices.