Serial1
and Serial2
are of type USARTSerial
But you would not want to do something like this
USARTSerial uart = Serial1;
but rather
USARTSerial *uart = &Serial1;
Or if you can opt for a reference
USARTSerial& uart = Serial1;
This is especially suitable for a sensor class where you pass the respective interface to use to the constructor.