Arduino Serial object data type, to create a variable holding a reference to a port

Viewed 8271

I'm working on a project with an ArduinoMega2560. There are multiple serial ports available, and I'd like to have a variable to hold a reference to one of them, something like this:

SerialPort port;
if (something == somethingElse)
    port = Serial;
else
    port = Serial1;

byte b = 5;
port.write(b);

However, the Arduino documentation is either limited or I haven't found the information I'm looking for. I think what I need it "What is the type for Serial, Serial1, etc?".

2 Answers
Related