How to view Serial1 data on a serial monitor

I have a question about the Arduino Mega2560. Sorry for the rudimentary content...
I want to check Serial1 and Serial2 data on the serial monitor, but I can only see Serial (unmarked) data. What should I do? The serial port options are shown in the picture.

void setup(){
  Serial.begin(9600);
  Serial1.begin(4800);
  Serial2.begin(19200);
  Serial3.begin(31250);

}

void loop() {

  Serial.println("Hello Computer");
  Serial1.println("Hello Serial 1");
  Serial2.println("Hello Serial 2");
  Serial3.println("Hello Serial 3");

  delay(1000);
}

Serial is the only port with a USB to serial converter so it is the only one that will show up in the ports.

You can pipe Serial1 data out via Serial.
Serial.print(Serial.read());
or
Serial.write(Serial.read());

Or get a USB to serial converter (FTDI), connect it to the Serial1 pins, open a new instance of the IDE, open serial monitor, set the serial port to the FTDI port and read from Serial1.

Thanks for the reply. I just tried that and the method of using a USB-to-serial converter (FTDI) worked! However, the former method did not work as shown in the picture. :smiling_face_with_tear:


Serial1.read() I think you mean?

Writing to Serial1 is not the same buffer that you read from.

You need to check if there is something available (Serial1.available>0) before reading or read() will return -1.

Right. I was not thinking well. That would necessitate connecting Serial and Serial1. But then both the serial monitor and Serial1 would be connected to Serial. Since only one thing should connect to a port at a time I would not expect it to work. The USB to serial converter is the way to go.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.