I just posted a "How To" in the Playground - "Multiplexing the MAX72xx to drive a 2 Color Matrix".
(It's linked from the "MAX7219 and MAX7221" section.)
It's my first Wiki, so I hope I did it correctly. I'll be happy to tweak it.
It doesn't compile well here... (Wiring environment + Wiring board)
I tested basically.. the first error was "wirig.h doesn't exist" or something like that
indeed, in Wiring environment the same library is TwoWire.h
I add the Wire lib from arduino to Wiring env... no problem for that.
But it remains some strange things:
libraries/MsTimer2/MsTimer2.h:11: error: 'boolean' does not name a type
MsTimer2.cpp:30: error: 'boolean' does not name a type
MsTimer2.cpp: In function 'void MsTimer2::set(long unsigned int, void (*)())':
MsTimer2.cpp:33: error: 'TCCR2B' was not declared in this scope
MsTimer2.cpp:35: error: 'TCCR2A' was not declared in this scope
MsTimer2.cpp:36: error: 'WGM22' was not declared in this scope
MsTimer2.cpp:37: error: 'AS2' was not declared in this scope
MsTimer2.cpp:38: error: 'TIMSK2' was not declared in this scope
MsTimer2.cpp:38: error: 'OCIE2A' was not declared in this scope
MsTimer2.cpp: In function 'void MsTimer2::start()':
MsTimer2.cpp:49: error: 'overflowing' was not declared in this scope
MsTimer2.cpp:51: error: 'TIMSK2' was not declared in this scope
MsTimer2.cpp: In function 'void MsTimer2::stop()':
MsTimer2.cpp:55: error: 'TIMSK2' was not declared in this scope
MsTimer2.cpp: In function 'void MsTimer2::_overflow()':
MsTimer2.cpp:61: error: 'overflowing' was not declared in this scope
o: In function `ClearMatrix()':
undefined reference to `MsTimer2::stop()'o: In function `SetColumn(unsigned char, unsigned char, unsigned char)':
o: In function `SetRow(unsigned char, unsigned char, unsigned char)':
o: In function `SetLed(unsigned char, unsigned char, unsigned char, unsigned char)':
o: In function `setup':
Im trying to edit the togShutdown to work with 3 max's, but i dont get why this wont work. Any ideas?
The debugging tells me: error: expected primary-expression before 'else'
(the second else statement. wich imo, shouldnt cause any problems)
With 3 colors,, you should probably reverse the logic anyway since there will always be 2 in shutdown.
You might also try a switch statement, although I've never used one in an ISR.
(only used else if in here, because i wanted to match statements)
I tried a switch statement, but i couldnt get pass the "error: expected unqualified-id before 'switch' In function 'void setup()':"
Havent tried the above written code yet, but as usual, i cant see why it shouldnt work.
Just to let you know, i tried this. But didnt work. (yet)
Wasnt sure about the breaks, but i tried both with and without, and no difference.
Anyone brighter than me, feel free to chip in!
void togShutdown(void) { //This ISR toggles shutdown between the 3 MAX7221's
switch (maxInShutdown) {
case RED:
lc.shutdown(GREEN,true);
lc.shutdown(BLUE,true);
lc.shutdown(RED,false);
maxInShutdown=GREEN;
break;
case GREEN:
lc.shutdown(RED,true);
lc.shutdown(BLUE,true);
lc.shutdown(GREEN,false);
maxInShutdown=BLUE;
break;
case BLUE:
lc.shutdown(RED,true);
lc.shutdown(GREEN,true);
lc.shutdown(BLUE,false);
maxInShutdown=RED;
}
}
Any chance someone will make a PCB for a shield to hold the MAX72xx's and an easily obtainable LED matrix? It looks like a lot of fun to play with but also a lot of tedious, error-prone soldering to prototype.
Oracle,
Your right. Having prototyped this a couple of times, it is a PITA (difficult) to solder up.
At the bottom of my profile, Arduino Playground - BroHogan I added a picture of a little board I had made that fits behind the Sparkfun RG matrix. Since it only requires 5 wires for SPI, I thought it was better to "shield" the matrix rather than the Arduino. (I did make a 2"x2" "Arduino" that fits behind the matrix shield as well.) The board works well.
I'd be glad to post the Eagle files if there is interest.
Yes, im quite the beginner with the C side of programming, even tho im quite capable in max/msp.
But im really willing to learn, even tho i do need some help sometimes to understand things. (as of now im dead-stuck)
Sorry for hijacking the thread, i thought it could interest more people than me. Ill start it up in the software section as recomended. Thanks again!