Trouble with Midi Shield: Baud Rate?

Hello Friends, developers, hackers, and tinkerers!

I’m having trouble getting my sparkfun Midi Shield to communicate to MIDI devices. I suspect it is a baud rate problem, but I can’t seem to trace down the exact issue.

This is what i built and what it should do. Sketch is below.

Momentary push button keeps track of the state, if it’s state 1 it lights a LED and generates a program change. If it’s state 2 it lights a different LED and generates a different program change.

PLEASE NOTE: At one point, this was working…now suddenly not.
The midi out is connected to a usb midiman 2x2 on a PC. Running MIDI-OX to monitor changes.

Many thanks for your help!

#include <MIDI.h>
/*
  Set a state of a variable when you press a pushbutton ( the 
  button went from off to on ). 
  
  created 01-12-2009 by kasperkamperman.com
  based on example 'State change detection' by Tom Igoe
*/

const int buttonPin  = 2;     // the pin that the pushbutton is attached to
const int ledPin     = 13;    // the pin that the LED is attached to
const int ledPinA     = 11;
const int ledPinB     = 12;

int buttonState      = 0;     // current state of the button
int lastButtonState  = 0;     // previous state of the button
int ledState         = 0;
int ledStateA        = 0;
int ledStateB        = 0;// remember current led state


void setup() {
  pinMode(buttonPin, INPUT);  // initialize the button pin as a input
  pinMode(ledPin, OUTPUT);
  pinMode(ledPinA, OUTPUT);
  pinMode(ledPinB, OUTPUT);// initialize the button pin as a output
  MIDI.begin(10);
  Serial.begin(31250);
}

void loop() {
  // read the pushbutton input pin
  buttonState = digitalRead(buttonPin);

  // check if the button is pressed or released
  // by comparing the buttonState to its previous state 
  if (buttonState != lastButtonState) {
    
    // change the state of the led when someone pressed the button
    if (buttonState == 1) {
      if(ledStateA==1) ledStateA=0;
      else            ledStateA=1;         
    }
     
    if (buttonState == 0) {
      if(ledStateB==1) ledStateB=0;
      else            ledStateB=1;         
    }
    
    if (buttonState == 1) {
      if(ledStateA==1) MIDI.sendProgramChange(6,10);
      
    }
    
    if (buttonState == 0) {
      if(ledStateB==1) if(ledStateA==1) MIDI.sendProgramChange(7,10);
      
    }
   // remember the current state of the button
    lastButtonState = buttonState;
     
  }
  
  // turns LED on if the ledState=1 or off if the ledState=0
  digitalWrite(ledPinA, ledStateA);
  digitalWrite(ledPinB, ledStateB);
  // adding a small delay prevents reading the buttonState to fast
  // ( debouncing )
  delay(5);
}

If it was working then what changed could give you a clue as to the cause? If nothing is changed then something may be broken.

Indeed! Yesterday, I found My midi device drivers went out of date causing errant messages in midi-ox.
A quick update resolved this issue...unfortunately, I spent way to long doubting myself instead of the hardware.

Thanks for looking into it!