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:
Serial.begin(9600);
The 9600 in the above function is a baud rate and you can change it according your need.
Here some more tutorials for you:
- LED Blinking Control by Potentiometer
- How to use an LCD Display with Arduino
- Ultrasonic Sensor with Arduino
- LDR Sensor with Arduino
- Servo Motor with an Arduino
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.
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.
Output

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.
