UART SERIAL COMMUNICATION BASICS SERIAL
In this code we use software serial instead of the hardware UART serial, to communicate with the Leonardo, Pin8 will be RX and pin9 will be TX. Write what is received to the softserial SoftwareSerial softSerial(8, 9) // 8=RX, 9=TX this is the code for the Mega Software Serial as Master Open your Serial Console, set it to 9600 baud speed rate if its not there yet, type the letter a on the text box on the top, the light on the Leonardo should go ON, type x on the text box and the light on the Leonardo should go OFF.On the Arduino Mega SoftSerial window in the Arduino IDE, make sure your comm port is set for the Arduino Mega.Connect the computer USB cable to your Mega.Connect a reliable power supply to your Leonardo.One end of one wire goes to Ground pin of Mega, the other side of the wire goes to the Ground pin of Arduino Leonardo.
![uart serial communication basics uart serial communication basics](https://3.bp.blogspot.com/-OsMrEV7ZlDk/WambrcgUQkI/AAAAAAAAAKM/VMuKkaX3WWY2AmCawQm7gkOmEoHRh6v4QCLcBGAs/w1200-h630-p-k-no-nu/9.uart.png)
![uart serial communication basics uart serial communication basics](https://cdn.mikroe.com/knowlegebase/uploads/2016/09/28172615/banner-strelice-1.jpg)
![uart serial communication basics uart serial communication basics](https://www.electronicshub.org/wp-content/uploads/2017/06/Serial-Communication.jpg)
This will not allow the Arduino UNO(Adafruit Metro 328) to communicate with the outside world AKA your computer. Please follow this step because your Arduinos use the "DEFAULT" SerialPort to upload your code from the Computer, once you make the physical wire connections the "Default" SerialPort will be used on the Arduino UNO (Adafruit Metro 328) to communicate with the Arduino Mega 2560 R3's SerialPort #1 which is pin19 RX1 and pin18 TX1 on the Mega. The connections will be UART to UART, SoftwareSerial to SoftwareSerial, UART to SoftwareSerial, and ALL 3 connected together!! :)īefore you make the physical wire connections.
UART SERIAL COMMUNICATION BASICS HOW TO
If you ever wonder how to use the other Serial ports on the Arduino Mega 2560 R3, but don't know where to start? This short tutorial we'll go over the basics, we'll connect to an Adafruit Metro 328 = its an Arduino compatible works just like an Arduino UNO R3, and we will connect to an Arduino Leonardo clone. This tutorial we are covering Serial Port Basics on the Arduino Mega 2560 R3.