title: Arduino Serial object data type, to create a variable holding a reference to a port
body: <p>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:</p>
  
  <pre><code>SerialPort port;
  if (something == somethingElse)
      port = Serial;
  else
      port = Serial1;
  
  byte b = 5;
  port.write(b);
  </code></pre>
  
  <p>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?".</p>