Clearing the terminal screen?

2019-04-04 05:13发布

I'm reading data from 9 different sensors for my robot and I need to display them all steadily, in the same window so I can compare the values and see if any of the readings is off.

The problem I'm having with both Serial.print and lcd.print is that the values are constantly moving and I can't really have a good look at them while moving the robot.

I was thinking to call something like Serial.clear() before displaying anything else and that would just keep things steady and in one place, changing only the values.

From what I found so far, Serial.print(17,BYTE) for instance is no longer supported (Calling the ESC key).

So...for those with a bit more Arduino experience...what is the proper way to do this?

14条回答
ら.Afraid
2楼-- · 2019-04-04 05:16

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.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-04-04 05:18
/*
As close as I can get to Clear Screen

*/


void setup() {
// put your setup code here, to run once:
Serial.begin(115200);

}

void loop() {

Serial.println("This is Line ZERO ");

// put your main code here, to run repeatedly:

for (int i = 1; i < 37; i++)
{

 // Check and print Line
  if (i == 15)
  {
   Serial.println("Line 15");
  }

  else
   Serial.println(i);  //Prints line numbers   Delete i for blank line
  }

  delay(5000);  

  }
查看更多
时光不老,我们不散
4楼-- · 2019-04-04 05:21

Found a stupidly simple way to fix this issue. Just resize the terminal window to only 1 line high and it will be a lot easier to read!

查看更多
再贱就再见
5楼-- · 2019-04-04 05:23

You could try:

Serial.write(13);

Which will provide a carriage return, returning to the start of the line every iteration - which should do what you're chasing? (Especially if everything is fixed width).

查看更多
Rolldiameter
6楼-- · 2019-04-04 05:26

If you change baudrate for example back and forth it clears the Serial Monitor window in version 1.5.3 of Arduino IDE for Intel Galileo development

查看更多
女痞
7楼-- · 2019-04-04 05:32

the best way I can think of is using processing there are a few introductions on the net like displaying serial data, arduino graph and arduino radar
Since Arduino is based on processing its not that hard to learn

查看更多
登录 后发表回答