I wrote the following code, which simply turns on LED when NoteOn event comes and turns it off, when NoteOff event comes.
void handleNoteOn(byte channel, byte pitch, byte velocity)
void handleNoteOff(byte channel, byte pitch, byte velocity)
digitalWrite(4, HIGH); // blink once to check if wiring is correct
The problem is that it doesn't work on my MEGA2560 board. The LED blinks once after reset (as it stands in setup function), but it doesn't react for any MIDI data. I checked it on UNO R3 board and it worked perfectly.
Link to the library: https://github.com/FortySevenEffects/arduino_midi_library/ (https://github.com/FortySevenEffects/arduino_midi_library/)