- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Serial.read(). 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.
Example
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: Serial.begin(9600); Serial.println(); } void loop() { // put your main code here, to run repeatedly: if(Serial.available()> 0){ char c = Serial.read(); Serial.print(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.
Output
- Related Articles
- How to Use a Serial Monitor with Arduino IDE 2.0?
- How to change the baud rate of the Serial Monitor in Arduino?
- Serial Plotter in Arduino
- Software Serial in Arduino
- Difference between hardware serial and software serial in Arduino
- View Serial Output in Arduino
- Serial Filtering Library in Arduino
- Stop Autoscroll in Serial Terminal in Arduino
- Digital Read in Arduino
- How to read data from EEPROM in Arduino?
- Read a file from SD Card connected to Arduino
- How to interface Arduino with a GSM Module and read SMS?
- Print hexadecimal values in Arduino
- Print binary values in Arduino
- Read a specific bit of a number with Arduino

Advertisements