Go Down

Topic: works: MIDI-IN: code + schematics (Read 49 times) previous topic - next topic


i know about the pain to debug this.

Some of the steps I've tried:
1) 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
2) I've tried both midi plug wiring options as described in this thread.
3) 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.
Code: [Select]

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

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,


thanks kuk.

1) I did make sure midi communication was occuring over channel 1.
2) I'm not getting any serial data, so i'm not filtering at all right now.

I have a bunch of 4n28s but I'm not sure the best way to validate it is still working.  Any quick hints?


nevermind!  Got it working, finally!

thanks for all the help.



Does anybody happen to have a copy of the schematic for this? Unless it's just something weird on my end, the image from the original post is missing. Thanks!

Go Up