I'm porting some code from Arduino Uno over to a Mega and I want to replace a SoftwareSerial defined in the previous code with one of the built-in UARTs.
Rather than go through and replace all references to the serial port, I'd prefer to create an alias for Serial1. The alias can be a constant.
In my old code, I setup the Software Serial as follows:
//SoftwareSerial HMI(HMIRX, HMITX); // Define software serial for the HMI adapter (RX, TX)
I"m not even sure where to start.
1 Answer 1
it is simple
#define HMI Serial1
answered Oct 22, 2017 at 7:37
-
Alternatively:
HardwareSerial &HMI = Serial1;
tttapa– tttapa2017年10月22日 11:29:26 +00:00Commented Oct 22, 2017 at 11:29