# Print plain text in Arduino

ArduinoArduino BoardsArduino IDEArduino Programming Language

To print plain text on the Serial Monitor, the Serial.print() function can be used.

In order to use this function, Serial needs to be initialized first (in the setup preferably). A typical implementation is shown below −

## Example

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("Hello!");
delay(100);
}

Note that the argument of Serial.begin() indicates the baud rate. You need to set the baud rate of your serial monitor to this value in order to read the printed messages properly. Often, the difference between the baud rate at which your microcontroller is transmitting and the baud rate at which the Serial Monitor is listening, leads to garbage values getting printed on the Serial Monitor.

The output of the above program, on the serial monitor, will be −

If you want to end the line after printing your message (or, in other words, make sure that the next message gets printed on a new line), you can use the Serial.println() function instead of Serial.print().

If you replace Serial.print() with Serial.println() in the above program, the output will be −

Published on 23-Mar-2021 11:20:25