4

Can I use the TX/RX on pins 0, 1 (to a serial slave device) while also having the USB port dedicated PC communication?

asked Apr 7, 2017 at 4:31
4
  • actually When you uploading a sketch to your board through USB programing port that time the skect might go to the serial device which is connected with Arduino through Rx and Tx pin Commented Apr 7, 2017 at 4:40
  • 1
    @Prayuktibid I couldn't see any signal on pins 0 or 1 with a scope when using the USB port, even with those pins set to an output. Commented Apr 7, 2017 at 4:47
  • 3
    @Prayuktibid he is using a Leonardo which has separate USB and hardware serial. Commented Apr 7, 2017 at 13:06
  • How to use USB and TX/RX at the same time? Commented Oct 1, 2018 at 14:44

1 Answer 1

4

32u4 is multi-serial uC. USB connection works on default serial communication which can be used via Serial.print("somevalue"). On the other hand if you want to use RX/TX on pins 0, 1 which are actually RXD1 and TXD1. So, if you use Serial1.print("somevalue"). So the answer is a yes. You can use USB and RX/TX (hardware serial) at the same time.

answered Apr 7, 2017 at 7:33
2
  • Great, thanks. Do you know how this compares with other boards? Apparently the Uno can't do use both. Commented Apr 7, 2017 at 8:50
  • 2
    Arduino Uno can't do this, it has only one hardware serial. Atmega 2560 has 4 hardware serials. Having multiple serials are always handy. With Uno you just stuck and have to use software serial if the case more than one serial. Most of the time Software Serial doesn't treat you well, it is just a workaround after all. Commented Apr 7, 2017 at 11:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.