ccgibson,
i know about the pain to debug this.
Some of the steps I've tried:
- I've verified my input pin works using a simple potentiometer. I can get Serial.Available to read an input byte with that set-up
- I've tried both midi plug wiring options as described in this thread.
- I've tried the circuit with and without the diode.
if you are already getting some serial data, i'd suggest checking just for a "144" (note-on message). Every keystroke should cause at least one.
if (Serial.available() > 0) {
blink(); //once to signal at least something arrived
// read the incoming byte:
incomingByte = Serial.read();
// wait for as status-byte, channel 1, note on
if (incomingByte== 144){ // note on message starting starting
// yeaha, we're getting something
blink();
blink():
blink();
}
}
if you're not receiving any data, you most likely have a problem with the opto setup. are you using the 4n28? can you verify that the optocpupler [still] works?
i'm not sure about your 2-watt resitors, but if they're that big, i could imagine them adding some noise. still i think you should get correct data in one of let's say a 100 key strokes.
remember that you need to set your keyboard (or whatever midi device you'Re using) to use midi channel 1 to use it with this code here.
good luck,
kuk