Serial communication in Arduino

Serial communication will provide an easy and flexible way for your Arduino board to interact with your computer and other devices.

You can also send data from the serial Monitor to Arduino by entering text in the text box to the left of the send button.

The main motive of serial communication is to display the data or send the data to Arduino using a graphic interface.

To enable the serial monitor we use the below function:


The 9600 in the above function is a baud rate and you can change it according your need.

Here some more tutorials for you:

Sending information from Arduino to Computer

The below sketch prints sequential numbers on the Serial Monitor. Upload the code and open the serial monitor for viewing the output.


serial communication in arduino output

Sending Formatted Text and Numeric Data from Arduino

The data to the serial port can be printed in many formats. By the below sketch we print different values in HEX, DEC and other forms.


serial communication in arduino

Receiving Serial Data in Arduino

We want to receive data on Arduino from a computer or another serial device. For e.g. we have to send data from the computer or commands to Arduino. This is also the best use of Serial communication in Arduino.

It’s easy to receive 8-bit values (chars and bytes) because the Serial function uses 8-bit values. The below sketch receives a digit (single character 0 through 9) and blinks the LED on pin 13 at a rate proportional to the received digit value.

Upload the above sketch and send a message using the serial Monitor. Open the serial monitor and type a digit in the text box at the top of the serial monitor window. Clicking the send button will send the character typed into the text box, you should see the blink rate change.

serial communication in arduino
Scroll to Top