Clearing the terminal screen?
I have found that ASCII 12 make a Form feed, that is a new page. here is a wikipedia definition
"Form feed is a page-breaking ASCII control character. It forces the printer to eject the current page and to continue printing at the top of another"
The code is
Serial.write(12);
Arduino Terminate doesn't support the character but Putty a light open source telnet client can do it
An Example of the code
void setup() {
Serial.begin(9600);//Initializase the serial transmiter speed
}
void loop() {
//Code tested with Putty terminal
Serial.write(12);//ASCII for a Form feed
Serial.println("This is the title of a new page");// your code
delay(500);//delay for visual
}
There is no way to clear the screen but, a really easy way to fake it can be printing as much Serial.println();
as you need to keep all the old data out of the screen.
The Arduino serial monitor isn't a regular terminal so its not possible to clear the screen using standard terminal commands. I suggest using an actual terminal emulator, like Putty.
The command for clearing a terminal screen is ESC[2J
To accomplish in Arduino code:
Serial.write(27); // ESC command
Serial.print("[2J"); // clear screen command
Serial.write(27);
Serial.print("[H"); // cursor to home command
Source:
http://www.instructables.com/id/A-Wirelessly-Controlled-Arduino-Powered-Message-B/step6/Useful-Code-Explained-Clearing-a-Serial-Terminal/