Created on: 2 August 2012
The Arduino Uno can send data (such as a text message) to the PC over the USB cable. The Arduino IDE has a serial monitor window that can be opened and will receive and display the data sent from the Arduino board. Data can also be sent to the Arduino board from the serial monitor.
This serial communication is very useful for controlling electronics that is connected to (interfaced to) the Arduino board from the PC. It can also be used to debug (find errors in) Arduino programs when writing new programs.
You can use the Arduino environment’s built-in serial monitor to communicate with an Arduino board. Click the serial monitor button in the toolbar and select the same baud rate used in the call to begin. The Arduino Reference text is licensed under a Creative Commons Attribution-Share Alike 3.0 License. Find anything that can be improved? Suggest corrections and new documentation via GitHub. Doubts on how to use Github? Learn everything you need to know in this tutorial. In this lesson, you will build on lesson 4, adding the facility to control the LEDs from your computer using the Arduino Serial Monitor. The serial monitor is the 'tether' between the computer and your Arduino - it lets you send and receive. The message “Enter LED Number 0 to 9 or 'x' to clear” has been sent by the Arduino, and it is. In this video, Zahraa uses an example to showcase the serial monitor by programming the built-in LED on the Arduino board that is connected to digital pin number 13, and uses the serial monitor window to see outputs.
Clear Serial Monitor Arduino Download
The following videos show what you will achieve in this tutorial.
Transmit a message from the Arduino to the PC:
Receive characters from the PC and transmit a message back to the PC:
Prerequisites
Complete tutorial 3 - Starting with Arduino before attempting this tutorial.
Components
All that is needed is an Arduino Uno board, standard USB cable and PC with the Arduino IDE software installed. You will already have these if you have completed tutorial 3.
Amazon.co.uk
Sending Data to PC from the Arduino
Copy the serial_tx_msg Arduino sketch below and paste it into the Arduino IDE.
Compile the program by clicking the 'Verify' button in the Arduino IDE. Upload the program to the Arduino board by clicking the 'Upload' button.
Now start the serial monitor by clicking the 'Serial Monitor' button in the Arduino IDE. The figure below shows the location of the serial monitor in Arduino IDE version 1.0 (top) and Arduino IDE version 0022 (bottom).
The serial monitor window should display a new 'Hello, world!' message every second. Note that the TX LED on the Arduino board lights up.
Sending Data from the Arduino to the PC
Copy the serial_rx_msg sketch below and paste it into the Arduino IDE.
This program receives data from the PC and then transmits it back to the PC with an additional message. It demonstrates receiving and transmitting data on the Arduino board.
In the Arduino IDE, verify and then upload the serial_rx_msg program to the Arduino board. Start the serial monitor program and enter a text character or sentence in the top field (to the left of the Send button). Click the Send button (or press Enter) to send the character or sentence.
For each character received, the Arduino board will send back 'You typed: ' and then the character that you typed.
Note that the TX and RX LEDs switch on for a brief moment when clicking the send button. This shows that data was sent and received.
Now that you know how the serial monitor works, we can use it in future Arduino projects.
Please enable JavaScript to view the comments powered by Disqus.
Beginner Tutorials
Electronic Components
Tools
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
How To Clear Serial Monitor Arduino
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
commented Nov 26, 2018 • edited
edited
Currently the serial monitor just displays incremental content (with / wo scrolling). There is no way to clear the screen from the arduino output in order to get a static screen. There has been some requirements in the past to include ANSI functionality, but the discussion always stalled... May I suggest to keep it simple and stupid? Please just provide a simple clear screen byte (e.g. Serial.write (12); // ASCII Form Feed to clear the screen). That simple improvement could make static screens and menues doable on the serial monitor. n.b. IMHO using an external ANSI terminal is not in the philosopy of the Arduino IDE. That is already something for freaks, needs external software, and the need to release the serial connection upon compiling is a pain. Regards and thank yo for considering my suggestion. |
added the Component: IDE Serial monitor label Nov 26, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment