Clearing the terminal screen?

后端 未结 14 2406
隐瞒了意图╮
隐瞒了意图╮ 2020-12-29 07:03

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 reading

14条回答
  •  别那么骄傲
    2020-12-29 07:50

    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/

提交回复
热议问题