Receiving data from two serial ports

Robin2:
You need a different non-blocking approach to receiving the data. Have a look at the examples in Serial Input Basics.

For example if you are using the second example you can have a copy of the function receiveWithEndMarker() for Serial1 and another copy for Serial2. Where the example causes the variable newData to be true you should have two separate variables newData1 and newData2 and then you can easily tell which port has received the data.

...R

Hmm would there be a more simpler way? Like I said, Serial1 and Serial2 will NOT be sending data at the same time. Either it will be Serial1 OR Serial2 who will be sending data the whole time.

I just need to find a way to select the port which is sending the data.