Can not seem to get 4 Max7219 modules to display correctly

Hi, first off, I am pretty new to programing and this is my first project with the Max7219 module and its library.

I am trying to prototype and test 4 Max7219 modules daisy chained together. I am running some test code to see if I can just get them to all work together.

Oddly, the number 0,2,3 modules in the chain of 0,1,2,3 are all working as I think I have programmed them to, but the number 1 module is not displaying the pattern I intended it to. I have replaced the module with another of the same kind, but the problem persists at the module in the number 1 position.

I have replaced the cables and double checked my connections.

I do not know where to go from here. I have included a picture of the modules with the misbehaving module.

Thank you for any help you can provide.

Here is my code:

//Max7219 test program
/*
Created by Rui Santos

All the resources for this project:

*/

#include "LedControl.h"
#include "binary.h"

/*
DIN connects to pin 12
CS connects to pin 11
CLK connects to pin 10

*/
int numLcs = 4;
//this initializes the pins, and is implied that ...= LedControl(dataPin,ClockPin,csPin,numDevices)
LedControl lc=LedControl(12,10,11,numLcs);

// delay time between faces
unsigned long delaytime=1000;

// ZERO
byte zero[8]= {B01010101,B10101010,B01010101,B10101010,B01010101,B10101010,B01010101,B10101010};
// ONE
byte one[8]= {B10101010,B01010101,B10101010,B01010101,B10101010,B01010101,B10101010,B01010101};

void setup() {
Serial.begin(9600);
//debug lines to be sure program recognizes 4 modules
Serial.print("total num devices is ");
Serial.println(lc.getDeviceCount());

//reset/set all modules
for(int i=0;i<numLcs;i++)
{
lc.shutdown(i,false);
// Set brightness to a medium value
lc.setIntensity(i,8);
// Clear the display
lc.clearDisplay(i);
}
}

void drawCheckers()
{
//Should alternate the checkerboards displayed
//modules 0,2 get one pattern, modules 1,3 get the pattern reversed
for(int i =0; i<8;i++)
{
lc.setRow(0,i,zero*);*
_ lc.setRow(2,i,zero*);_
_ lc.setRow(1,i,one);
lc.setRow(3,i,one);
}
delay(delaytime);*_

* for(int i =0; i<8;i++)*
* {*
_ lc.setRow(0,i,one*);
lc.setRow(2,i,one);
lc.setRow(1,i,zero);
lc.setRow(3,i,zero);*_

* }*
* delay(delaytime);*
}
void loop()
{
* drawCheckers(); *
}
IMG_0676.JPG

IMG_0676.JPG

OK, first things first.

You need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the "More -> Modify" option below the right hand corner of your post - to mark up your code as such using the "</>" icon in the posting window. Just highlight each section of code (or output if you need to post that) from the IDE and click the icon.

In fact, the IDE has a "copy for forum" link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But even before doing that, don't forget to use the "Auto-Format" (Ctrl-T) option first to make it easy to read. If you do not post it as "code" it can as you now see, become garbled and is always more difficult to read.

It is inappropriate to attach it as a ".ino" file unless it is clearly too long to include in the post proper. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And that would also assume they are using a PC and have the IDE running on that PC.

Also tidy up your blank space. Do use blank lines, but only between functional blocks.


Now,

yesmarc:
the number 1 module is not displaying the pattern I intended it to.

What does that mean?

I cannot quite discern from your picture, what that module is showing. When you say

yesmarc:
I have replaced the module with another of the same kind

I presume you mean that you simply unplugged a pair of the modules and swapped their positions with another pair; this would be the simplest way.

Otherwise I cannot pick where the problem is in the code, but when you correct your post it my be easier to see.

Those modules are not very useful, the "FC-16" ones are more useful for most things. What is your eventual intention?