problems using 4 8x8 LED displays driven by max7219

Helloo everyone so I have problem programing 4 8x8 LED matrices. when I used only 1 display everything were just fine. But when I tried to use 4 displays after uploading the code all displays blink one by another instead of going lit bit by bit. Could you help me to figure out the problem why my displays don’t work?
here is the code :

#include "LedControl.h"
int DIN = 12;
int CS = 11;
int CLK = 10;
LedControl lc = LedControl (DIN,CS,CLK,4); // 4 is for matrixes that I am using

void setup(){
  for(int i=0; i<4;i++){
 lc.shutdown(i,false);       // matrices usually is in power saving mode that turns off it.
 lc.setIntensity(i,5);      // Sets the brightness of leds in matrix
 lc.clearDisplay(i);         // clears the display
}

void matrix(byte number_of_unit) {
  for(int row=0;row<8;row++) {
    for(int col=0;col<8;col++){
      lc.setLed(number_of_unit-1,row,col,true);
      delay(30);
    }
  }
}

void loop() {

  for (byte i=0; i<4; i++){
    matrix(i);
  }
 
}

delay(30); That's pretty quick between LEDs - try making this longer.

CrossRoads:
delay(30);
That’s pretty quick between LEDs - try making this longer.

Changed it but still nothing… Even when I trie to use codes where display have to write something my displays just blink randomly without doing anything

Hi, How are you powering all the LED arrays?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Do you have a DMM?

Thanks.. Tom... :)

3rn1z:
Helloo everyone so I have problem programing 4 8x8 LED matrices. when I used only 1 display everything were just fine. But when I tried to use 4 displays after uploading the code all displays blink one by another instead of going lit bit by bit. Could you help me to figure out the problem why my displays don’t work?
here is the code :

#include "LedControl.h"

int DIN = 12;
int CS = 11;
int CLK = 10;
LedControl lc = LedControl (DIN,CS,CLK,4); // 4 is for matrixes that I am using

void setup(){
 for(int i=0; i<4;i++){
lc.shutdown(i,false);       // matrices usually is in power saving mode that turns off it.
lc.setIntensity(i,5);      // Sets the brightness of leds in matrix
lc.clearDisplay(i);         // clears the display
}

void matrix(byte number_of_unit) {
 for(int row=0;row<8;row++) {
   for(int col=0;col<8;col++){
     lc.setLed(number_of_unit-1,row,col,true);
     delay(30);
   }
 }
}

void loop() {

for (byte i=0; i<4; i++){
   matrix(i);
 }

}

From loop() it looks like you call matrix with the arguments 0 to 3…

In matrix() it looks like you are subtracting one from “what was the argument”
when calling setled " lc.setLed(number_of_unit-1,row,col,true); "

this will make setled() use an argument between -1 and 2… This might be part of the issue :slight_smile:

TomGeorge: Hi, How are you powering all the LED arrays?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Do you have a DMM?

Thanks.. Tom... :)

Hello well it is 8x8 led matrices and they are attached to max7219 controllers I hadn't setted up any circuit for this.

kajnorman: this will make setled() use an argument between -1 and 2.. This might be part of the issue :-)

Ok gonna try that, and actually this part were coppied from a tutorial in youtube for testing reasons. I have done the same things when I started from basics pasted someones code, then analyse it if it works and try to use it like example for other projects. I have tried to makes codes by watching tutorials f.e. Brainy-bits tutorials and still nothing. My displays blink one by one and don't do what it should do by code. Thanks.

TomGeorge: Hi, [u]How are you powering all the LED arrays?[/u]

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

[u]Do you have a DMM?[/u]

Thanks.. Tom... :)

Please answer the other two questions.... :o :o :o

Tom.... :)