Serial 3 Round Robin problem

I’ve got data receiving on Serial 3 from an RS232 interface, and only wish for it to transmit to Serial 0. Right now, whatever data is received on Serial 3 Rx is being transmitted back on Serial 3 Tx, causing issues with my interface. How would I eliminate that data from being sent back around in this sketch?

#include <MIDI.h>


MIDI_CREATE_INSTANCE(HardwareSerial, Serial3, controller);
MIDI_CREATE_INSTANCE(HardwareSerial, Serial, pt);

byte lastChannel = 0;
byte pp;

byte mute[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
byte solo[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
byte select[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
byte rec[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};

void ControllerHandleCC(byte channel, byte pitch, byte velocity) {
  //Mute Press
  if(pitch == 0x46)
  {
    pt.send(midi::ControlChange,0x0F,channel-1,1);
    pt.send(midi::ControlChange,0x2F,0x42,1);
  }
  //Solo Press
  else if(pitch == 0x47)
  {
    pt.send(midi::ControlChange,0x0F,channel-1,1);
    pt.send(midi::ControlChange,0x2F,0x43,1);
  }
  //Fader first
  else if(pitch == 0x07)
  {
    lastChannel = channel;
    pp = velocity;
  }
  //Fader second
  else if(pitch == 0x27)
  {
    if(channel == lastChannel)
    {
      byte qq = velocity;
      pt.send(midi::ControlChange,0x0F,channel-0x01,1);
      pt.send(midi::ControlChange,0x2F,0x40,1);
      pt.send(midi::ControlChange,channel-0x01,pp,1);
      pt.send(midi::ControlChange,channel-0x01+0x20,qq,1);
      pt.send(midi::ControlChange,0x0F,channel-0x01,1);
      pt.send(midi::ControlChange,0x2F,0x00,1);
    }
    
    lastChannel = 0;
  }
  //Select Press Ch
  else if(pitch == 0x49)
  {
    pt.send(midi::ControlChange,0x0F,channel-0x01,1);
    pt.send(midi::ControlChange,0x2F,0x41,1);
  }
  //Rec Press Ch
  else if(pitch == 0x48)
  {
    pt.send(midi::ControlChange,0x0F,channel-0x01,1);
    pt.send(midi::ControlChange,0x2F,0x47,1);
  }
  //Send Flip
  else if(pitch == 0x70 || pitch == 0x71 || pitch == 0x72 || pitch == 0x73)
  {
    pt.send(midi::ControlChange,0x0F,0x0B,1);
    pt.send(midi::ControlChange,0x2F,0x44 + 0x73 - pitch,1);
    pt.send(midi::ControlChange,0x0F,0x0C,1);
    pt.send(midi::ControlChange,0x2F,0x43,1);
  }
}

void PTHandleCC(byte channel, byte pitch, byte velocity) {
  //Effect Control
  if(pitch == 0x0C)
  {
    lastChannel = velocity + 1;
  }
  else if(pitch == 0x2C)
  {
    byte data1, data2;
    //Mute Press Ch
    if(velocity == 0x42)
    {
      mute[lastChannel - 1] = 0x7F;
      data1 = 0x46;
      data2 = 0x7F;
    }
    else if(velocity == 0x02)
    {
      mute[lastChannel - 1] = (mute[lastChannel - 1] ^ 0xFF) & 0x7F;
      data1 = 0x46;
      data2 = mute[lastChannel - 1];
    }
    //Solo Press Ch
    else if(velocity == 0x43)
    {
      solo[lastChannel - 1] = 0x7F;
      data1 = 0x47;
      data2 = 0x7F;
    }
    else if(velocity == 0x03)
    {
      solo[lastChannel - 1] = (solo[lastChannel - 1] ^ 0xFF) & 0x7F;
      data1 = 0x47;
      data2 = solo[lastChannel - 1];
    }
    //Select Press Ch
    else if(velocity == 0x41)
    {
      select[lastChannel - 1] = 0x7F;
      data1 = 0x49;
      data2 = 0x7F;
    }
    else if(velocity == 0x01)
    {
      select[lastChannel - 1] = (select[lastChannel - 1] ^ 0xFF) & 0x7F;
      data1 = 0x49;
      data2 = solo[lastChannel - 1];
    }
    //Rec Press Ch
    else if(velocity == 0x47)
    {
      rec[lastChannel - 1] = 0x7F;
      data1 = 0x48;
      data2 = 0x7F;
    }
    else if(velocity == 0x07)
    {
      rec[lastChannel - 1] = (rec[lastChannel - 1] ^ 0xFF) & 0x7F;
      data1 = 0x48;
      data2 = solo[lastChannel - 1];
    }
    
    controller.send(midi::ControlChange,data1,data2,lastChannel);
  }
  else if(pitch == 0x00 || pitch == 0x01 || pitch == 0x02 || pitch == 0x03 || pitch == 0x04 || pitch == 0x05 || pitch == 0x06 || pitch == 0x07)
  {
    controller.send(midi::ControlChange,0x07,velocity,pitch + 0x01);
  }
  else if(pitch == 0x20 || pitch == 0x21 || pitch == 0x22 || pitch == 0x23 || pitch == 0x24 || pitch == 0x25 || pitch == 0x26 || pitch == 0x27)
  {
    controller.send(midi::ControlChange,0x27,velocity,pitch - 0x20 + 0x01);
  }
}

void PTHandleNoteOff(byte channel, byte pitch, byte velocity) {
  if(pitch == 0x00&& velocity == 0x00 && channel == 0x01)
    pt.send(midi::NoteOn,0x00,0x7F,channel);
}


void setup()
{
    // Initiate MIDI communications, listen to all channels
    controller.begin(MIDI_CHANNEL_OMNI);
    pt.begin(MIDI_CHANNEL_OMNI);
    
    Serial3.begin(38400);
    
    controller.setHandleControlChange(ControllerHandleCC);
    pt.setHandleControlChange(PTHandleCC);
    pt.setHandleNoteOff(PTHandleNoteOff);
}

void loop()
{
  controller.read();
  pt.read();
}

How would I eliminate that data from being sent back around in this sketch?

Isn't that obvious? Stop calling controller.semd().

Sorry I guess I wasn't clear enough. I need controller.send() to transmit the data arriving on Serial 0 to Serial 3. But what I can't figure out is why data (that isn't even programmed in the sketch) is looping back to itself on Serial 3... Basically specific data isn't being transmitted to Serial 0, I can see that via the RxTx lights on the Arduino... But that signal is transmitting AND receiving on Serial 3. Hmmm....

I don't see any reference to serial0 in your code.

zoomkat: I don't see any reference to serial0 in your code.

MIDI_CREATE_INSTANCE(HardwareSerial, Serial, pt);

The 8u2 is boot loaded with Hiduino. The data is passing to Serial 0 and outputting to my PC. Additionally, data being sent to the Arduino is received by Serial 0 and converted, then sent to Serial 3

The 8u2 is boot loaded with Hiduino. The data is passing to Serial 0 and outputting to my PC. Additionally, data being sent to the Arduino is received by Serial 0 and converted, then sent to Serial 3

Glad you got it working.

zoomkat: Glad you got it working.

I haven't. Data received on Serial 3 is still transmitting back to itself on Serial 3... Its like a short circuit in the loop.

Data flow Should be Controller>serial3>serial0>PC>serial0>serial3>controller