How To Receive and Send Serial Data Using Arduino Board

By
Advertisement
Serial communication is the easiest way to communicate with the peripheral device in embedded system. Thus, during this article, you may be able to learn the way to receive and send serial data from the arduino board. If you are beginner then first read this Introduction to Arduino Board and How To Send Serial Data From Arduino To Laptop or PC before moving on this article.
serial communication virtual terminal monitor
Arduino ide has such a big amount of inbuilt function for serial communication and detail of some function are here  How To Send Serial Data From Arduino To Laptop or PC. During this article, we tend to use some additional function that facilitates us to receive the serial data from the serial port. These functions are Serial.available(), Serial.read(), Serial.write whose explanation are given below:

1: Serial.available()

This function is always used before the Serial.read() function. This function returns always a positive value once reception is complete. This function is used for whether or not entire data is received.

2: Serial.read()

This function is used to read the received data from the serial port. We will save received data in any variable for any condition to ascertain.The variable could also be integer or character.

3: Serial.write()

This function is same as Serial.print() and Serial.println() explained in How To Send Serial Data From Arduino To Laptop or PC. This function returns the data to the serial port of the arduino.

Circuit diagram: 

circuit diagram for serial communication
Circuit Diagram
Code:
code for receiving serial data from laptop
Code
Download:


Video:


If you have got any question concerning this article then be happy to comment below or contact us via social network like facebook 

0 comments:

Post a Comment