Is RX/TX pin the same than the serial wire (USB)


I read that Arduino uno has only one serial port which is the one used when we do : Serial.begin(9600);

I usually use this instruction to communicate with the Serial monitor via USB.

While there is also TX /RX that are supposed to be Serial port.

Is TX/RX the same serial port than the USB ?

Thanks in advance

Yes. Note that's also used for uploading sketches to your Uno.

Is TX/RX the same serial port than the USB ?

You can follow the traces on the board, and see that they are.

In which order they are used ?

Which one has the priority over the other one ?

If I connect my arduino via USB (to power my board and for serial monitoring) and at the same time use RX/TX pins for an Xbee communication, is that possible ?

Thanks for your replies

What you describe is not likely to work. For instance, when using hardware serial as you describe there is no way of saying "this should go to the Serial monitor" or "this should go to the Xbee". Neither has priority. Furthermore, the two systems will not be electrically isolated.

Consider using SoftSerial for the Xbee. There are examples in the IDE, or use an Arduino board with more than one hardware serial interface

There is a form of priority. Okay, all things are lost if both speak at the same time but the Uno has resistors in line between uC and the USB (chip). So the device connected to the RX and TX pins will win and the USB will be ignored as far as talking to the uC (uC Rx). And for the uC talking (uC Tx) it will simply talk to both the device and the USB (chip) at the same time without both knowing for which of the two the message is for.

Time for the Uno R4 based on the ATmega328PB :D

In which order they are used ?

At the same time.

Which one has the priority over the other one ?

Neither one. You send data out of the Arduino, using Serial.write() (directly, or because print() called it), and it goes to the TX pin AND the USB-to-serial converter at the same time.

You have one serial port. If you connect two things to it, you will have to make sure that EVERYTHING that you send out is understood by both devices.