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(); *
}