I am tearing my heir out over MIDI!

I can not get my Arduino to play my keyboards through MIDI :frowning: I've done it before but it just won't work now.

So I am a bit embarrased to ask but I'm desperate...

I've tried multiple keyboards (and checked by running a keyboard off another through MIDI) and multiple arduinos (diecimila 168 and Mini Pro 328 16MHz).

I've wired according to this diagram:

I have tried to run the arduino off an external powersupply (with the USB disconnected) but that did not work either...

WHAT IS WRONG!?

Here is the code:

//from examples *modified
int note = 60;

void setup() {
// Set MIDI baud rate:
//Serial.begin(31250);
Serial.begin(9600);
pinMode(13,OUTPUT);
}

void loop() {
//Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
noteOn(0x90, note, 0x45);
digitalWrite(13,HIGH);
delay(1000);
//Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
noteOn(0x90, note, 0x00);
digitalWrite(13,LOW);
delay(1000);
}

void noteOn(int cmd, int pitch, int velocity) {
Serial.print(cmd, BYTE);
Serial.print(pitch, BYTE);
Serial.print(velocity, BYTE);
}

/me fail

The baud rate appears to be set to 9600 instead of the proper 31250. Does it work if you comment out the 9600 and enable the 31250?

-br

http://entropymouse.com

How embarrasing!
The 9600 was just for some debugging. I use the 31250 when testing :slight_smile:

And no, it does not work..

http://itp.nyu.edu/physcomp/Labs/MIDIOutput
http://www.arduino.cc/playground/Main/InterfacingWithHardware#MIDI

Ton of info

I don't know anything about midi, so I can't help you here but... I'm guessing english is your second language. :slight_smile:

Using 220ohm (I think the image says 228 [ch937]), read all the info, english is my second language and the post was written as fast as my fingers could type.

:slight_smile:

Normally it is pins 4 & 5 that get swapped, is the diagram you posted looking at the front of the socket or looking at the back?

The ground on pin 2 is not needed and a proper MIDI lead will not have a wire in this position. In fact a ground on pin 2 can cause problems sometimes. Yes I know the ITP web sit has one on but that is one hell of a bad site for errors.

Thank you Grumpy! :slight_smile:

I think the MIDI page should mention that it views the connector from the front (got to blame someone right ;)).