How to print an empty line on Serial Monitor
How to print an empty line on Serial Monitor of Arduino IDE?
Answer
There are two ways to print an empty line on Serial Monitor:
- Use Serial.println();
- Use Serial.print("\r\n");
Let's see two examples to know the difference:
Example with Serial.print()
void setup() {
Serial.begin(9600);
Serial.println("START");
Serial.println(); // the 1st empty line
Serial.print("\r\n"); // the 2nd empty line
Serial.println("END");
}
void loop() {
}
The result on Serial Monitor
COM6
START
END
Autoscroll
Clear output
9600 baud
Newline
Buy Arduino
1 × Arduino UNO Buy on Amazon | |
1 × USB 2.0 cable type A/B Buy on Amazon | |
1 × Jumper Wires Buy on Amazon |
Please note: These are Amazon affiliate links. If you buy the components through these links, We will get a commission at no extra cost to you. We appreciate it.