I have found a sketch in Wokwi where a MAX7219 LED matrix is used. The sketch subject is to display 0 using <LedControl.h>. I don't understand why it's nessesary to send 0 unlike 1 in fourth parameter in library-object initialization.
LedControl(int dataPin, int clkPin, int csPin, int numDevices=1);
It seems it should be 1 there, but the sketch isn't working in that way.
#include <LedControl.h>
int DIN = 12;
int CS = 11;
int CLK = 10;
LedControl lc=LedControl(DIN,CLK,CS,0);
void setup(){
lc.shutdown(0,false);
lc.setIntensity(0,15);
}
void loop(){
byte zero[8]= {0x00,0x1c,0x22,0x22,0x22,0x22,0x22,0x1c};
printByte(zero);
}
void printByte(byte character []) {
int i = 0;
for (i=0;i<8;i++) {
lc.setRow(0,i,character[i]);
}
}