hello guys,
i am trying to make a daisy chain MAX7219 codes work,
i have 2 MAX7219 chained together, the first has 2 double digit CA 7-segment display connected to it and the second has 1 single digit CA 7-segment display connected to it,
when i try and down load count up codes for 1 MAX7219 it works for all the 7-segment in the same time, of course for 1 digit it displays 1 number
so now i am trying to make a count alone for the single digit and another count up for the other MAX7219
I make a first version of codes trying to understand how it works, when i uploaded the single digit on the second MAX7219 goes off and the other display continue working normally, so i need please to know how this works and what should be done ?
here are my codes :
//We always have to include the library
#include <LedControl.h>
/*
Now we need a LedControl to work with.
***** These pin numbers will probably not work with your hardware *****
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
We have only a single MAX72XX.
*/
LedControl lc=LedControl(12,11,10,2,true); //true for Common Anode
void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/
//First MAX7219
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,15);
/* and clear the display */
lc.clearDisplay(0);
//Second MAX7219
lc.shutdown(1,false);
/* Set the brightness to a medium values */
lc.setIntensity(1,15);
/* and clear the display */
lc.clearDisplay(1);
Serial.begin(9600);
}
/*
This method will display the characters for the
word "Arduino" one after the other on digit 0.
*/
void displayCount(){
int i;
int ones;
int tens;
int hundreds;
int thousands;
for(i=0; i<10000; i++){
//must add a new variable which is a here to store value of i in it,
//we should not mess with the i because it's for the for() loop
int a = i;
ones=a%10;
a=a/10;
tens=a%10;
a=a/10;
hundreds=a%10;
a=a/10;
thousands=a;
lc.setDigit(0, 0, ones, false);
lc.setDigit(0, 1, tens, false);
lc.setDigit(0, 2, hundreds, false);
lc.setDigit(0, 3, thousands, false);
delay(100);
}
for(i=0; i<10; i++){
//must add a new variable which is a here to store value of i in it,
//we should not mess with the i because it's for the for() loop
int a = i;
ones=a;
lc.setDigit(1, 0, ones, true);
delay(100);
}
}//-------- end of void displayCount()
void loop() {
displayCount();
}