Serial1 Echo Serial

Hello,

Based on my googling I don't think this is possible but I thought I would ask. Using the Wifi Rev2 I know there are three hardware serial uarts on the board. Serial goes to the USB and Serial1 goes to Pin 0 and 1. What I'm interested in for my project is a way to send the same data to Serial and Serial1 at the same time.

Thanks

Serial.print(something);
Serial1.print(something);

or write a function to do it for you

void outToSerial(int data)
{
  Serial.print(data);
  Serial1.print(data);
}

then call it like this

outToSerial(data);

Thank you, I had thought though the first option but didn't want to duplicate all the print statements. I guess I needed more coffee this morning as to why I didn't think of the second.

my StreamLib has a TeePrint class
https://github.com/jandrassy/StreamLib#printing-to-two-outputs-at-once-aka-tee

or you can write your own

1 Like

Thanks @Juraj. I will take a look.

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