MIDI program change

Hi,

I have a problem with MIDI program changes. In my current Arduino code, there’s one variable that’s changed by up- & down switches and should return a value between 1 and 127 (returning to 1 after 127 is reached and vice versa).

My problem is that my MIDI monitor (a free mac application) and my MIDI device that I want to use my project with don’t cycle through 1-127, but only 49 - 57.

I copied this part from an existing project cause my own code didn’t work: http://arduino.cc/playground/Learning/MidiFoot

The code uses BYTE statements which cause compiler problems. I also use the MIDI CC changes from the example (they also had the BYTE statement which I removed) and they work fine.

When I check the values with the Arduino serial monitor, everything looks fine (1-127, then back to 1).

So here are the triggers:

void triggerX() {
  //Serial.println("Trigger X");
  
  if (midiPgm > 1) { 
     midiPgm = midiPgm - 1;
     }
  else {
     midiPgm = 127;
  }
  midiProg(0xC0, midiPgm);
  //Serial.print("MIDI Pgm #: ");
  //Serial.println(midiPgm);    
}


void triggerY() {
  //Serial.println("Trigger Y");
  if (midiPgm < 127) { 
     midiPgm = midiPgm + 1;
     }
  else {
     midiPgm = 1;
  }
  midiProg(0xC0, midiPgm);
  //Serial.print("MIDI Pgm #: ");
  //Serial.println(midiPgm);    
}

Here’s midiProg:

void midiProg(char state, int data ) {
  Serial.print(state);
  Serial.print(data);
}

I played around with different possibilities (sending the midiPgm value as hex or decimal number, converting the value with byte() etc.)
but couldn’t get this to work.

Any ideas? Since both the hardware MIDI preamp and the MIDI monitor software show that the values are only between 49 - 57, I assume they’re right and that I messed up something or things don’t get sent out in the right format.

Thanks for your help

Please help... :~

I still can't figure out why the Arduino serial console displays the "correct" value (1..2.....127, then back to 1) while MIDI only cycles from 49 - 57.

Any ideas?

Thanks,

M.