Read values sent by Serial Monitor to Arduino

The Serial Monitor of Arduino has a text box at the top, through which, users can send in text to the Arduino board.

The text can be read by Also, the Serial.available() function can be used to check if there is any data to read. It returns the number of characters or bytes available for reading, i.e., the number of bytes stored in the serial receive buffer.


Using these functions, let’s create a simple echo program for Arduino. The code for the same can be found below −

void setup() {
   // put your setup code here, to run once:

void loop() {
   // put your main code here, to run repeatedly:
   if(Serial.available()> 0){
      char c =;

Over here, it is best that you check the Serial Monitor output for yourself. Try sending text to your board, and see it echo it back to you.