1
votes

I'm using an Arduino mega which has 4 serial ports. On the main serial port continuously sending and receiving data between the Arduino and a computer. The computer is doing some calculations and sending the results back to the arduino.

I'd like to see the data that the Arduino is receiving from the computer but doing a normal Serial.print() will also send that data back to the computer, creating a big endless loop of garbage data.

Is there a way to print to the screen using on of the other serial ports. I'm thinking that I can read/write on port1 and then send the data back to the screen using port2?

1

1 Answers

0
votes

I don't own a Mega myself, so take this with a grain of salt, but as far as i know, the three additional serial ports are not connected to the USB-to-serial port. Serial1-Serial3 can only be used to communicate with other devices by connecting TX(Mega) with RX(device) and vice versa.

OK, since i didn't know exactly, i had a look at the Arduino Mega specs. It says:

Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the corresponding pins of the FTDI USB-to-TTL Serial chip.

Sorry for the bad news.