Arduino Serial Communication Basics : Learn Arduino

Arduino serial communication is one of the many ways Arduino talks to other devices. Arduino uses asynchronous serial communication to send-receive data to and from other devices. Arduino Uno supports serial communication via on-board UART port and Tx/Rx pins. Generally this transmission happens at 9600 bits per second which is termed as baud rate. [caption id=”attachment_840” align=”aligncenter” width=”424”] Arduino Uno Shown with UART port and Tx,Rx Pins[/caption] Arduino may communicate with many devices including:

  • Another Arduino
  • A computer
  • LCD display
  • Modem
  • Or any device that supports serial communication

How to do it? In this example we’ll connect Arduino and a computer using UART port. For this we are going to use Arduino IDE’s Serial Monitor. Serial Monitor will display data we sent from Arduino Uno. Code:

void setup() {
Serial.begin(9600);
}

void loop() {
Serial.println(“Hello World…”);
delay(1000);
}

Upload this code and select Tools > Serial Monitor (Shift+Ctrl+M). You should see this output. [caption id=”attachment_841” align=”alignnone” width=”579”] Serial Monitor output on the computer[/caption] Further Reading:

  1. Wikipedia: Serial communication
  2. Arduino Reference: Serial

Arduino Serial Communication Basics : Learn Arduino

http://idevji.com/arduino-serial-communication-basics.html

Author

Devji Chhanga

Posted on

2018-08-04

Updated on

2023-08-22

Licensed under

Comments