Friday, 1 April 2016

Arduino Yun Rx Tx doesn't work


If you use Rx Tx to write data to other devices by Serial (Arduino Rx-> device Tx and ArduinoTx-> device Rx), if you experience of that the same code work with Arduino Uno but doesn't work with Arduino Yun.


I think you must have realised that something wrong here, because when you are uploading your code into Arduino Uno, you must disconnect Rx and Tx to upload, because they are occupying the Serial port. so you can't use it for uploading at the same time. Of course you can fix this by using software Serial for connecting to your devices. Back to the issue we are facing.... however, when you are uploading your code into Arduino Yun, you have no issues of uploading. So Yun but use different Serials.

Solution:
You should use "Serial1" instead of "Serial". But make sure that, if you are using Serial for logging, then you still need to use Serial, but for "write"and "read", then you should use "Serial1"


  • Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data using the ATmega32U4 hardware serial capability. Note that on the Yún, the Serial class refers to USB (CDC) communication; for TTL serial on pins 0 and 1, use the Serial1 class. The hardware serials of the ATmega32U4 and the AR9331 on the Yún are connected together and are used to communicate between the two processors. As is common in Linux systems, on the serial port of the AR9331 is exposed the console for access to the system, this means that you can access to the programs and tools offered by Linux from your sketch.




No comments:

Post a comment