Can I use the TX/RX on pins 0, 1 (to a serial slave device) while also having the USB port dedicated PC communication?
-
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 pinPrayuktibid– Prayuktibid2017年04月07日 04:40:58 +00:00Commented 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.101– 1012017年04月07日 04:47:19 +00:00Commented Apr 7, 2017 at 4:47
-
3@Prayuktibid he is using a Leonardo which has separate USB and hardware serial.gre_gor– gre_gor2017年04月07日 13:06:41 +00:00Commented Apr 7, 2017 at 13:06
-
How to use USB and TX/RX at the same time?Aye Chan Myat Phyoe– Aye Chan Myat Phyoe2018年10月01日 14:44:39 +00:00Commented Oct 1, 2018 at 14:44
1 Answer 1
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.
-
Great, thanks. Do you know how this compares with other boards? Apparently the Uno can't do use both.101– 1012017年04月07日 08:50:51 +00:00Commented Apr 7, 2017 at 8:50
-
2Arduino 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.Sener– Sener2017年04月07日 11:08:09 +00:00Commented Apr 7, 2017 at 11:08