I want to be able to set which Serial port gets my debugging messages, depending on the setting of a single directive.
With Serial 1 to Serial 3, this is simple enough - I make each "print" using a variable that holds the serial definition, with the definition set using a directive:
HardwareSerial *mySerialPort;
#ifdef USE_SERIAL2
mySerialPort=&Serial2;
#else
mySerialPort=&Serial1;
#endif
mySerialPort->begin(460800);
mySerialPort->println(F("Here is a test message"));
BUT - what if I want the option to use SerialUSB? Trying to set
mySerialPort=&SerialUSB;
I get "error: cannot convert 'Serial_' to 'HardwareSerial' in assignment"
Any suggestions?