Using multiple serial ports in Arduino due

Hi All,

I have been using an Arduino Due board for a project. I need to use 2 serial ports, one to communicate with an LCD(port 3) and another to communicate with an atmega328 (port 1). I also need to use one more to communicate one with the PC (Port 0). I have been doing the following initializations:

INITIAL CODE:

void setup() {

. . genieBegin (GENIE_SERIAL_3, 9600); //Initialize Serial port 3 to communicate with LCD Serial.begin(9600); //Initialize Serial port 1 to communicate with ATmega-328 . . }

void loop() {...}

All communications were proper (both to the LCD and atmega) I now wanted to add a serial communication to the PC as well (for debugging).

MODIFIED CODE:

void setup() { Serial.begin(9600); . . genieBegin (GENIE_SERIAL_3, 9600); //Initialize Serial port 3 to communicate with LCD Serial1.begin(9600); //Initialize Serial port 1 to communicate with ATmega-328 . . }

void loop() { Serial.println(".............") // message to printed on serial monitor

...}

Unfortunately, now the code is not working. I am just a beginner. Please help!!! :disappointed_relieved:

You only have one hardware serial port. Use that to communicate with the PC (it's the only one that can). Use SoftwareSerial to communicate with the other devices.

koelsinha: Unfortunately, now the code is not working. I am just a beginner. Please help!!! :disappointed_relieved:

If you want help with a code problem you need to post real code, not a redacted version. Write a test sketch that demonstrates the problem in the simplest possible way without any extraneous code, and post that in its entirety in code tags, together with the complete compiler output if it's a compilation problem or a description of what you expected it to do and what it actually does if it's a runtime problem.

PaulS: You only have one hardware serial port. Use that to communicate with the PC (it's the only one that can). Use SoftwareSerial to communicate with the other devices.

Doesn't the due have 3 hardware serial ports? Why use software serial?

casemod:

PaulS:
You only have one hardware serial port. Use that to communicate with the PC (it’s the only one that can). Use SoftwareSerial to communicate with the other devices.

Doesn’t the due have 3 hardware serial ports? Why use software serial?

Because sometimes I can’t read. I saw Due and read Uno.