To preface: I am attempting to turn a Casio SA-35 into a MIDI keyboard. I have an Arduino Uno R3 and some generic midi jack. I'm using Cantabile Lite (a live VST performance software.) I have the wires hooked up as per this: http://arduino.cc/en/Tutorial/Midi?from=Tutorial.MIDI and I tested the code from that page. It works correctly with Cantabile. I then substituted in my own code, in the file below (it was too long for the post.) BUT, when I tested the code Cantabile freaked out and started playing random notes. I changed Arduinos and it helped a little but after testing a few keys it started freaking out again. I also tested this with Ableton (the demo, although I doubt it makes a difference) and FL Studio (again, the demo, but I doubt this is the problem.) In both cases the midi freaked out and played randomly. I don't know if it was an error in my code or what. Thanks for any help you can provide! Also I'm really sorry about the terrible code, I should probably take a class.
midifinal.ino (8.36 KB)