changing hardware serial ports on a mega

Hello I wonder if anyone could help me to change the standard serial port in my code? I'm using a Mega and receiving midi messages on the standard hardware serial port. I wish to change this to any of the Mega's three other serial ports.

// include MIDI library
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();

// include libraries for controlling servos and debouncing buttons
#include <Servo.h>

// declare objects to represent the two servos
Servo bigServoLeft;
Servo littleServoLeft;

Servo bigServoRight;
Servo littleServoRight;

// set global variables for left servo
int notePositionsLeft[] = {59, 75, 91, 106, 123};
int beaterRestAngleLeft = 123; // (123)lower number raises beater!
int beaterHitAngleLeft = 117; // (117) hit angle must lower than rest angle
int postHitDelayLeft = 50; // (100) 50

// set global variables for right servo
int notePositionsRight[] = {82, 100, 116, 132, 150};
int beaterRestAngleRight = 68; // (68) higher number raises beater
int beaterHitAngleRight = 73; // (73) hit angle must be higher than rest angle
int postHitDelayRight = 50; // (100) 50

// leds
int ledPin1 = 23;
int ledPin2 = 25;
int ledPin3 = 27;
int ledPin4 = 29;
int ledPin5 = 31;
int ledPin6 = 33;
int ledPin7 = 35;
int ledPin8 = 37;
int ledPin9 = 39;
int ledPin10 = 41;


void setup() {

  // left servo
  bigServoLeft.attach(43);
  littleServoLeft.attach(45);
  bigServoLeft.write(90);
  littleServoLeft.write(beaterRestAngleLeft);

  // right servo
  bigServoRight.attach(47);
  littleServoRight.attach(49);
  bigServoRight.write(116);
  littleServoRight.write(beaterRestAngleRight);

  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);
  pinMode(ledPin5, OUTPUT);
  pinMode(ledPin6, OUTPUT);
  pinMode(ledPin7, OUTPUT);
  pinMode(ledPin8, OUTPUT);
  pinMode(ledPin9, OUTPUT);
  pinMode(ledPin10, OUTPUT);

  MIDI.setHandleNoteOn(moveToMidiNote);
  MIDI.setHandleNoteOff(hitBeater);


  MIDI.begin(MIDI_CHANNEL_OMNI);

  

}

void loop() {
  MIDI.read();
}

int moveToMidiNote(byte channel, byte midiNote, byte velocity) {
  int noteNum = getGlockNoteFromMidiNote(midiNote);
  if (noteNum >= 0 & noteNum <= 4) {
    bigServoLeft.write(notePositionsLeft[noteNum]);
  } else {
  }
  if (noteNum >= 5 & noteNum <= 9) {
    bigServoRight.write(notePositionsRight[noteNum - 5]);
  } else {
  }
}

int hitBeater(byte channel, byte midiNote, byte velocity) {
  int noteNum = getGlockNoteFromMidiNote(midiNote);
  if (noteNum >= 0 & noteNum <= 4) {
    littleServoLeft.write(beaterHitAngleLeft);
    delay(postHitDelayLeft);
    littleServoLeft.write(beaterRestAngleLeft);
  } else {
  }
  if (noteNum >= 5 & noteNum <= 9) {
    littleServoRight.write(beaterHitAngleRight);
    delay(postHitDelayRight);
    littleServoRight.write(beaterRestAngleRight);
  } else {
  }
}


int getGlockNoteFromMidiNote(int midiNote) {
  switch (midiNote) {
    case 60:
      digitalWrite(ledPin1, HIGH);
      delay(10);
      digitalWrite(ledPin1, LOW);
      return 0;
    case 62:
      digitalWrite(ledPin2, HIGH);
      delay(10);
      digitalWrite(ledPin2, LOW);
      return 1;
    case 64:
      digitalWrite(ledPin3, HIGH);
      delay(10);
      digitalWrite(ledPin3, LOW);
      return 2;
    case 65:
      digitalWrite(ledPin4, HIGH);
      delay(10);
      digitalWrite(ledPin4, LOW);
      return 3;
    case 67:
      digitalWrite(ledPin5, HIGH);
      delay(10);
      digitalWrite(ledPin5, LOW);
      return 4;
    case 69:
      digitalWrite(ledPin6, HIGH);
      delay(10);
      digitalWrite(ledPin6, LOW);
      return 5;
    case 71:
      digitalWrite(ledPin7, HIGH);
      delay(10);
      digitalWrite(ledPin7, LOW);
      return 6;
    case 72:
      digitalWrite(ledPin8, HIGH);
      delay(10);
      digitalWrite(ledPin8, LOW);
      return 7;
    case 74:
      digitalWrite(ledPin9, HIGH);
      delay(10);
      digitalWrite(ledPin9, LOW);
      return 8;
    case 76:
      digitalWrite(ledPin10, HIGH);
      delay(10);
      digitalWrite(ledPin10, LOW);
      return 9;
  }
  return -1;
}

Thanks in advance

To use Serial1, for example, try this:

//MIDI_CREATE_DEFAULT_INSTANCE(); <-- comment out
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);   // <-- add this

YMMV.

Thanks Blackfin. I gave that a try and got this "'Serial1' was not declared in this scope".
Should I be making changes elsewhere?

goatboyrobbie:
Thanks Blackfin. I gave that a try and got this "'Serial1' was not declared in this scope".
Should I be making changes elsewhere?

That's strange. I copied your code, created a Mega project, made this change and it compiled successfully (though I did not actually try it.)

Are you sure the Mega2560 is the board selected in the IDE?

Brilliant! I was testing another board since posting and that was my problem! Compiles now perfectly. Now to see if this works. Thanks Blackfin!!

Perfect! Working exactly as I need it to...Thanks again!