hello
i am in the process of putting together a 5 x 5 x 5 led matrix. i am using 2 max7219 chips to control the led's but have run into some trouble with the code. i was hoping to just have two matrix's running alongside each other controlled over midi - so that notes 1-64 control the first matrix and then 65-125 control the second. but it doesn't want to work. has anyone had much experience with using multiple max 7219 chips? any thoughts would be really appreciated.
thanks
(here is the code I have so far)
#include <Sprite.h>
#include <Matrix.h>
#include <MIDI.h>
Matrix myMatrix = Matrix(4, 3, 2);
Matrix newMatrix = Matrix(7, 6, 5);
int midiNote;
int x;
int y;
void setup() {
MIDI.begin();
myMatrix.clear();
newMatrix.clear();
}
void loop() {
if (MIDI.read()) {
midiNote = MIDI.getData1();
// if the midiNote is 64 or under send it to the led driver
if (midiNote <= 128) {
convertMidiToCoordinates(midiNote);
switch (MIDI.getType()) {
case NoteOn:
myMatrix.write(x, y, HIGH);
break;
case NoteOff:
myMatrix.write(x, y, LOW);
break;
}
} else {
midiNote -= 64;
convertMidiToCoordinates(midiNote);
switch (MIDI.getType()) {
case NoteOn:
newMatrix.write(x, y, HIGH);
break;
case NoteOff:
newMatrix.write(x, y, LOW);
break;
}
}
}
}
void convertMidiToCoordinates(int midiNote) {
x = midiNote / 8;
y = midiNote % 8;
}