Clear Terminal screen!

Hello everybody!I would like to ask you something...

Look at this function:

void clearAndHome()
{
  Serial.print(27, BYTE); // ESC
  Serial.print("[2J"); // clear screen
  Serial.print(27, BYTE); // ESC
  Serial.print("[H"); // cursor to home
}

This function clears the screen.But this is supported only in older versions of Arduino( like 0022 ).
I'm using Arduino version 1.But it's not supported!Do you now how to fix it???

Have you ever tried this thing??

thanks a lot!

Try using a VT100 compatible terminal emulator.

This function clears the screen.

Clears what screen? My Arduino doesn't have a screen.

Sorry PaulS please don't joke with me !
I said that i'm newbie and i would appreciate if you could help me.
Sorry for my mistakes.I know that when someone then the possibility to make errors is grower.So???
What should i say about that?

My Arduino Com previews a menu with choices.But i don't know how can make the loop to clear the old display messages.

In other words thats my problem!

sirus:
Hello everybody!I would like to ask you something...

Look at this function:

void clearAndHome()

{
  Serial.print(27, BYTE); // ESC
  Serial.print("[2J"); // clear screen
  Serial.print(27, BYTE); // ESC
  Serial.print("[H"); // cursor to home
}




This function clears the screen.But this is supported only in older versions of Arduino( like 0022 ).
I'm using Arduino version 1.But it's not supported!Do you now how to fix it???

Have you ever tried this thing??

thanks a lot!

So, you are printing serial data back to the connected computer, possibly using a terminal emulator to read the data coming back from the Arduino...? Or, are you using the built-in serial monitor?

This probably doesn't belong in "Programming Questions", but, as suggested elsethread this really depends on the terminal settings.

Unless your question is about the Arduino serial monitor, in which case the fact that some version cleared the screen for this particular escape char sequence might have been more luck than purpose.

Why not send a whole bunch of 'newline' commands? That should be fairly universal and not rely on escape sequences that may not be as universal.

Don

Hi everyone!
I use
void clearAndHome()
{
Serial.print(27, BYTE); // ESC
Serial.print("[2J"); // clear screen
Serial.print(27, BYTE); // ESC
Serial.print("[H"); // cursor to home
}

or

void clearAndHome()
{
Serial.write(27);
Serial.print("[2J"); // clear screen
Serial.write(27);
Serial.print("[H"); // cursor to home
}

but my Serial Monitor does not clear. It shows '[2Je[H' symbols.

[2Je[HHumidity: 34.00 % Temperature: 29.00 *C 84.20 *F Heat index: 28.13 *C 82.63 *F
e[2Je[HHumidity: 34.00 % Temperature: 29.00 *C 84.20 *F Heat index: 28.13 *C 82.63 *F
e[2Je[HHumidity: 34.00 % Temperature: 29.00 *C 84.20 *F Heat index: 28.13 *C 82.63 *F

Why this happened?

Because whatever monitor you have doesn't support those ANSI escape sequences. Pretty simple, really.

Thank you, KeithRB for answer. What should I do in my case?

What terminal program are you using? The one in the IDE is very basic. Use something like PuTTY that can understand escape sequences.

Instead of Serial Monitor, use a terminal program that supports VT100. Tested with RealTerm (under Windows) and it clears the screen; I'm sure there are plenty others.