Skip to main content
1 of 2

syntax for declaring more than one serial pins of arduino mega?

how can i declare multiple serial ports of arduino mega? as for single it is like given below?

#include <SoftwareSerial.h>
SoftwareSerial mySerial(18,19); // RX, TX  //how this syntax can be modified for multiple Rx module?
void setup()
{
Serial.begin(9600);
}

void loop(){
  Serial.write(45); // send a byte with the value 45

   int bytesSent = Serial.write(“helloâ€); //send the string “hello†and return the length of the string.
}