Why isn't my circuit reading outputted MIDI signals? (LED triggered by MIDI)

(deleted)

I think the default is channel 1 but if you change the MIDI.begin() to MIDI.begin(MIDI_CHANNEL_OMNI) it will listen on all channels.

But what MIDI input circuit are you using? Please provide a circuit diagram showing what is connected where.

Also what Arduino? Tone doesn't work on everything.

Steve

(deleted)

That's not a schematic and my eyesight isn't good enough to see details in that picture but at least you seem to have an optoisolator and I'll trust the resistors are the right values.

Have you tried it with MIDI_CHANNEL_OMNI? What does it do, if anything? Have you tried your keyboard with anything else so you're confident it actually is transmitting MIDI?

Steve

(deleted)

If you have a simple MIDI to USB cable like MIDI to USB Interface Cable Adapter for Keyboard Electronic Drum Music | eBay then there are loads of PC programs that will tell you what is being sent. I normally use an old program called MIDIOX from http://www.midiox.com/ but there are many others.

Otherwise try this really simple program. It should just switch the onboard pin 13 LED on when you hold any key down and switch it off when you release the key. If that doesn’t work either your wiring is wrong or the keyboard isn’t sending any MIDI NoteOn/Off commands.

#include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

// -----------------------------------------------------------------------------

void handleNoteOn(byte channel, byte pitch, byte velocity)
{
  digitalWrite(13, HIGH);  // switch LED on
}

void handleNoteOff(byte channel, byte pitch, byte velocity)
{
  digitalWrite(13, LOW);  // switch LED off
}

// -----------------------------------------------------------------------------

void setup()
{
  MIDI.setHandleNoteOn(handleNoteOn);  // Put only the name of the function

  MIDI.setHandleNoteOff(handleNoteOff);

  // Initiate MIDI communications, listen to all channels
  MIDI.begin(MIDI_CHANNEL_OMNI);
}

void loop()
{
    MIDI.read();
}

Steve

(deleted)

Some versions of that circuit pull pin 7 of the optoisolator to ground with 4k7 or so, increasing the
speed.

See the schematic here: Notes and Volts: Midi for the Arduino - Build a Midi Input Circuit

I did consider checking that the keyboard was transmitting MIDI - I had a look online for something cheap that could test MIDI signals but I didn't have any luck, is there anything you could recommend?

Use a 220 ohm resistor and a red LED on the MIDI out to see if there is activity.