lol. I'll happily donate to your cause. Got paypal?
Thanks for the clear explanation in the code. I understand much more now. There still seems to be a problem in the lighting of the LED. I'm getting the signal out of ableton and into arduino (the RX led is lighting). Midiox is telling me I'm sending the right information, though it is written in hex on midiox-could that be the problem?
I think most likely, I have just done something stupid and dropped a bit of code somewhere or something. Thank you for your help and patience in working with me! Here is the complete code I'm using now:
//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,1);
/* we always wait a bit between updates of the display */
unsigned long delaytime=100;
//variables setup
byte incomingByte;
int statusLed = 13; // select the pin for the LED
void setup() {
/*
The MAX72XX is in power-saving mode on startup,
we have to do a wakeup call
*/
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
//setup: declaring iputs and outputs and begin serial
pinMode(statusLed,OUTPUT); // declare the LED's pin as output
Serial.begin(57600); //start serial with midi baudrate 31250 or 38400 for debugging
}
void loop () {
if (Serial.available() > 0) { //if serial incoming
incomingByte = Serial.read(); //read it
if (incomingByte==144){ // analyse the first byte (status) : 144 is note on ch1
incomingByte = Serial.read(); //read the next byte
if (incomingByte==60){ // analyse the second byte (note) : 60 is middle C
incomingByte = Serial.read(); //read the next byte
if(incomingByte>0){ //analyse the third byte : velocity >0
lc.setLed(0,3,3,true);
}else{ //analyse the third byte : velocity=0
lc.setLed(0,3,3,true);
}
}
if (incomingByte==61){ // analyse the second byte (note) : 61 is middle C#
incomingByte = Serial.read(); //read the next byte
if(incomingByte>0){ //analyse the third byte : velocity >0
lc.setLed(0,3,3,true);
}else{ //analyse the third byte : velocity=0
lc.setLed(0,3,3,false);
}
}
}
}
}
Cheers!
Joel Laviolette