ARDUINO SERIAL
MONITOR
• The Serial Monitor is a built-in feature of the
Arduino Integrated Development Environment
(IDE) that allows users to communicate with
their Arduino board using serial communication.
• It acts as a text-based interface where users
can send and receive data between their
computer and the Arduino in real-time.
1. What is the Arduino Serial
Monitor?
• The Serial Monitor is a tool that provides a
simple way to:
• Display data from sensors (e.g., temperature,
light, motion sensors).
• Debug code by printing variable values at
different points in the program.
• Send commands to the Arduino (e.g., control
LEDs, motors, or other components).
• Monitor real-time data transmission for
projects involving Bluetooth, Wi-Fi, or other serial
communication modules.
Applications of Serial Monitor
Printing Data to the Serial Monitor
• To display text or values on the Serial Monitor,
we use the [Link]() and [Link]()
functions.
• void setup() {
• [Link](9600); // Start serial communication at 9600
baud rate
•}
• void loop() {
• [Link]("Hello, Arduino!"); // Print text on Serial
Monitor
• delay(1000); // Wait for 1 second
•}
Understanding Serial Print Functions
What is [Link]()
• The [Link]() function prints data to the Serial
Monitor without moving to a new line. This means that
multiple [Link]() statements will print text
continuously on the same line.
Using [Link]()
• void setup() {
• [Link](9600); // Start serial communication
• }
• void loop() {
• [Link]("Temperature: ");
• [Link](25);
• [Link]("°C "); // Space to separate values
• delay(1000);
• }
Output in Serial Monitor:
Temperature: 25°C Temperature: 25°C Temperature:
25°C ...
Key Points:
• The text is printed continuously on the same line.
• No automatic line breaks are added.
• Spaces or separators (,, \t, " ") must be manually
included.
What is [Link]()
• The [Link]() function is similar to [Link](),
but it automatically moves the cursor to a new line after
printing the data.
Using [Link]()
• void setup() {
• [Link](9600); // Start serial communication
•}
• void loop() {
• [Link]("Temperature: ");
• [Link](25);
• [Link]("°C");
•
• [Link]("Humidity: 60%"); // Prints and moves to a new
line
• delay(1000);
•}
Output in Serial Monitor:
Temperature: 25°C
Humidity: 60%
Key Points:
• [Link]() adds a newline (\n) at the end.
• It is useful for structuring output properly in the Serial
Monitor.
• It prevents data from getting cluttered on a single line.
Difference Between [Link]()
and [Link]()
• void setup() {
• [Link](9600);
•}
Output:
• void loop() {
Temperature: 25 C
• [Link]("Temperature: "); Humidity: 60%
• [Link](25); // No newline
• [Link](" C");
• [Link]("Humidity: 60%"); // Newline is included
• delay(2000);
•}
Using Serial Monitor for Debugging
• A common use of the Serial Monitor is debugging
Arduino programs.
Adjusting the Baud Rate
• The baud rate defines how fast data is transmitted
between the Arduino and the Serial Monitor.