I'm using a max7219 like this one max7219. When I first tested my circuit, I used an 8x8 display and the code worked just fine. Now, after I modified the code and changed the display with the chained one, the text is showing only on the first matrix. I've seen someone that had another problem with the same matrix module, only that in his case the same text was printed on all the matrixes unsolved problem, in the end he didn't find a solution. Below, I'll attach my code. Please help me find the problem.
//Pin connected to ST_CP of 74HC595
int latchPin = 6;
//Pin connected to SH_CP of 74HC595
int clockPin = 7;
////Pin connected to DS of 74HC595
int dataPin = 5;
int period = 30;
byte rotl(byte n, byte b)
{
return (n << b) | (n >> (8 - b));
}
byte X[] {
0x80,
0x80,
0x80, //L
0x80,
0x80,
0x80,
0x80,
0xFF,
/*0x10,
0x00,
0x10, //I
0x10,
0x10,
0x10,
0x10,
0x10,
0XF0,
0x90,
0x80, //C
0x80,
0x80,
0x80,
0x90,
0xF0,
0xF0,
0x09,
0x09,
0x09,
0x09,
0x09, //A
0x09,
0xF0*/
};
void setup() {
//set pins to output so you can control the shift register
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop()
{
for (int i = 0; i < 8; i++)
{
X[i] = rotl(X[i], 1);
}
for(int i = period;i>0;i--)
{
displayX();
}
}
void DisplayMatrix(byte numCol, byte numLine)
{
byte numberToDisplay1 = numCol;
byte numberToDisplay2 = numLine;
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay1);
shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay2);
digitalWrite(latchPin, HIGH);
delay(1);
}
void displayX()
{
DisplayMatrix(X[0],1);
DisplayMatrix(X[1],2);
DisplayMatrix(X[2],4);
DisplayMatrix(X[3],8);
DisplayMatrix(X[4],16);
DisplayMatrix(X[5],32);
DisplayMatrix(X[6],64);
DisplayMatrix(X[7],128);
}