Project 2.00 Serial Printing

In this project, you'll learn how to utilize the Arduino's Serial communication capabilities to print text data to your computer's Serial Monitor!

In this project you will be introduced to Serial. Serial is a great way to see what is happening while your projects are running. Serial allows you to print strings of text, numbers and more out into a “Serial Port”. To open the Serial Port, click the magnifying glass in the top right of the Arduino IDE, or press ctrl + shift + m.

Here is what the magnifying glass will look like:

When you open the Serial port, it will appear in a window at the bottom of the screen. This is where the things you print will be displayed. Make sure to change this to “Newline” if it’s not already.

Project Code:

				
					/////////////////////////////////////////////////
// 2.00 - Serial Printing

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.print("My name is: "); 
  Serial.println("YourNameHere");
  delay(1000);
}
/////////////////////////////////////////////////
				
			

*If you’re copying and pasting the code, or typing from scratch, delete everything out of a new Arduino sketch and paste / type in the above text.

This line initializes the Serial port for communication. The 9600 value passed is the “Baud rate”. Baud rate is the rate of bits transmitted per second. Because our microcontroller has a built-in USB interface, the number we pass here does not matter.

				
					  Serial.begin(9600);
				
			

There are a few common ways to print information to this screen. We can use the Serial.print and/or Serial.println methods.

The difference is that the Serial.println method will print a new line after it prints what was passed to it. It is important to note that if the data being printed is a string of characters, they need to be enclosed in quotations. If it is a single character, it can be enclosed in quotations or apostrophes. Otherwise, numbers and variables do not need to be enclosed in anything special.

				
					  Serial.print("My name is: "); 
  Serial.println("YourNameHere");
				
			

Change out the “YourNameHere” string with your name (enclosed in quotation marks).

Try making them both just Serial.print and see what happens!

A delay is needed to keep our MC Trainer from printing thousands of lines of text in a few seconds!

				
					delay(1000);
				
			

Make sure and open the Serial port to see what is being printed!

Learn More In Our Free Instructional Guidebook

This comprehensive guidebook for the 1st Maker Space Microcontroller Trainer provides a comprehensive introduction to the world of Arduino programming for beginners. It guides users through the foundational concepts of microcontrollers, detailing the unique features of the Arduino Leonardo-compatible MCU Trainer board. The manual offers a step-by-step journey from understanding the hardware components and the Arduino programming language to the vibrant global community of Arduino enthusiasts. It delves into the intricacies of each onboard circuit, explaining their functionalities and applications. With a focus on hands-on learning, the manual includes a series of coding exercises, tutorials in C/C++, and insights into the Arduino IDE.

More Projects

Developmental Project 1.00 Vote

In this project, vote using the OLED and buttons.

Developmental Project 2.00 Mind the Dog

The program demonstrates how embedded systems can track time without stopping the program. Instead of using delay(), which pauses execution, it uses the millis() timestamp technique to calculate elapsed time. This allows multiple tasks—timers, display updates, and LED indicators—to run simultaneously.