Tell us about yourself!
I too am having the same issues using the Timer version as forgoden and sjonniesjon. It only seems to read the commandByte correctly, the noteByte and velocityByte always return 255. Maybe the bytes following the commandByte are missed due to the timer? Do you have any recommendations besides removing the >2 in the while clause to get this to work like the checkMIDI() function does? The checkMIDI() version works fine (despite the polyphony issues of course). This timer version does not work properly from your provided code. I know this is an old thread, perhaps there are better tutorials on this type of MIDI functionality by now? I'm open to suggestions here for better MIDI Input and Output processing code.