midi note player problems with arduino micro

Hi,
I have uploaded the following example code to both a arduino uno(r3) and an arduino micro and the micro is not working.
the Tx led lights up on the uno and my midi device receives the signal.
with the micro the led does not light up and the midi device does not receive a signal.
does the code for the micro need to be modified?
should I be concerned about a damaged board?
I should mention that the Tx andRx led’s light up during upload of the sketch.
Thanks for any help…

/*
 MIDI note player
 
 This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data.
 If this circuit is connected to a MIDI synth, it will play 
 the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence.

 
 The circuit:
 * digital in 1 connected to MIDI jack pin 5
 * MIDI jack pin 2 connected to ground
 * MIDI jack pin 4 connected to +5V through 220-ohm resistor
 Attach a MIDI cable to the jack, then to a MIDI synth, and play music.

 created 13 Jun 2006
 modified 13 Aug 2012
 by Tom Igoe 

 This example code is in the public domain.
 
 http://www.arduino.cc/en/Tutorial/Midi
 
 */
void setup() {
  //  Set MIDI baud rate:
  Serial.begin(31250);
}

void loop() {
  // play notes from F#-0 (0x1E) to F#-5 (0x5A):
  for (int note = 0x1E; note < 0x5A; note ++) {
    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, note, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00);   
    delay(100);
  }
}

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}

What about a simple blink sketch?

(please use code tags when posting code)

AWOL,
blink sketch works fine on internal led pin 13 and to external led on all tested pins included pin 1...
??

I have now also tried the code using Serial1 with no success… =(
there is something I am missing …

void setup() {
  //  Set MIDI baud rate:
  Serial1.begin(31250);
}

void loop() {
  // play notes from F#-0 (0x1E) to F#-5 (0x5A):
  for (int note = 0x1E; note < 0x5A; note ++) {
    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, note, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00);   
    delay(100);
  }
}

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial1.write(cmd);
  Serial1.write(pitch);
  Serial1.write(velocity);
}

there is something I am missing

Probable

  • digital in 1 connected to MIDI jack pin 5
  • MIDI jack pin 2 connected to ground
  • MIDI jack pin 4 connected to +5V through 220-ohm resistor

Often people mix up the pins 5 & 4 on the MIDI jack, due to looking at the plug from the wrong side. These two pins are either side of the center pin. Try swapping them over.