Serial comm issue using MIDI shield

(first project)

Ive been playing with my AT mega 2560 and a midi shield for a while and I’ve managed to get all my analog inputs, digital outs, and pretty lights to flash when I want, but I cant seem to figure out how to get the board to receive MIDI signals. I have a theory though… Looking at the schematic of the midi shield, there is a SPDT switch at the Rx pin which could only be this mysterious PROG/RUN switch, and Im thinking that the usb connection that im using to program the board is using that Rx pin. So I dont have any pins connected to the midi in jack when the switch is in the ‘PROG’ position. I like my theory, but I have no idea what to do with it. If I flip the switch to ‘RUN’ I cant upload anything to the board, and my boot-up led-light-show doesn’t happen on powerup. Meaning none of my code is loaded when the switch is in the ‘RUN’ position.
Whats going on here?

#include "Arduino.h"

//#define KNOB1  0
//#define KNOB2  1

#define BUTTON1  2
#define BUTTON2  3
#define BUTTON3  4



#define STATR  7
#define STATG  6


 int incomingByte;
 int byte1;
 int byte2;
 int byte3;
 int sread;
 char stemp[10];

void setup(){

 //start serial with midi baudrate 31250 or 38400 for debugging
 Serial.begin(31250);     
  //Serial.begin(38400); 
  //Serial.println("MIDI Board");   


  pinMode(STATR,OUTPUT);   
  pinMode(STATG,OUTPUT);

  pinMode(BUTTON1,INPUT);
  pinMode(BUTTON2,INPUT);
  pinMode(BUTTON3,INPUT);


  digitalWrite(BUTTON1,HIGH);
  digitalWrite(BUTTON2,HIGH);
  digitalWrite(BUTTON3,HIGH);


  for(int i = 0;i < 10;i++)
  {
    digitalWrite(STATR,HIGH);  
    digitalWrite(STATG,LOW);
    delay(30);
    digitalWrite(STATR,LOW);  
    digitalWrite(STATG,HIGH);
    delay(30);
  }
  digitalWrite(STATR,HIGH);   
  digitalWrite(STATG,HIGH);

}

void loop(){
	if(!digitalRead(BUTTON3)){ 
		digitalWrite(STATR,LOW);
		delay(150);
		digitalWrite(STATR,HIGH);
	}
  
 //*************** MIDI OUT ***************//
/*
  //int pot = analogRead(1);
  //int note = pot/8;  // convert value to value 0-127
	
		if(button(BUTTON1))  {    
    		noteOn(0x90,0x1E,0x45);
			//Serial.write("onif\r\n");
			digitalWrite(STATG,LOW);
			while(button(BUTTON1)) ;
			//Serial.write("off\r\n");
			noteOn(0x80,0x1E,0x45);
			digitalWrite(STATG,HIGH);
		}
		else{
			;
		}

		else if(button(BUTTON1))	{
			digitalWrite(STATR,LOW);
			//Serial.write("\r\n"+pot);
			Serial.write("\r\n"+note);
			while(button(BUTTON3));
			digitalWrite(STATR,HIGH);
		}
		
*/

		//*************** MIDI LOOPBACK ******************//
/*
  if(Serial.available() > 0)  {
    byte1 = Serial.read();
    byte2 = Serial.read();
    byte3 = Serial.read();
  
    noteOn(byte1, byte2, byte3);
    
	Serial.println(byte1);
	Serial.println("/n");
	Serial.println(byte2);
	Serial.println("/n");
	Serial.println(byte3);

    digitalWrite(STATG,LOW);  
    delay(200);
	digitalWrite(STATG,HIGH);
  }

*/
  
		//*************** MIDI IN ***************//

  //sread = Serial.readBytes(stemp,10);
  //Serial.println(sread);

  if (Serial.available()) {
    // read the incoming byte:
    digitalWrite(STATG,LOW);
	delay(200);
	digitalWrite(STATG,HIGH);

	incomingByte = Serial.read();
	Serial.println(incomingByte, HEX);
  }

/*	  
    // wait for as status-byte, channel 1, note on or off
    if (incomingByte== 144){ // note on message starting starting
      action=1;
    }
    else if (incomingByte== 128){ // note off message starting
      action=0;
    }
    else if (incomingByte== 208){ // aftertouch message starting
      //not implemented yet
    }
    else if (incomingByte== 160){ // polypressure message starting
      //not implemented yet
    }
    else if ( (action==0)&&(note==0) ){ // if we received a "note off", we wait for which note (databyte)
      note=incomingByte;
      playNote(note, 0);
      note=0;
      velocity=0;
      action=2;
    }
    else if ( (action==1)&&(note==0) ){ // if we received a "note on", we wait for the note (databyte)
      note=incomingByte;
    }
    else if ( (action==1)&&(note!=0) ){ // ...and then the velocity
      velocity=incomingByte;
      playNote(note, velocity);
      note=0;
      velocity=0;
      action=0;
    }
    else{
      //nada
    }*/
  
  
}




void noteOn(int cmd, int data1, int data2) {
   Serial.write(cmd);
   Serial.write(data1);
   Serial.write(data2);
 }

char button(char button_num)
{
  return (!(digitalRead(button_num)));
}

The bootloader and MIDI shield share the receive pin. Set the switch to PROG when you want to upload a sketch. Set the switch to RUN when you want to get MIDI input.

I could have sworn I tried that... but apparently not. Now it works just like it should. -Thank you