-
-
Notifications
You must be signed in to change notification settings - Fork 481
Description
Hi,
Currently in Serial Port (Arduino IDE 2.0.3) it is only possible to print text lines with LineFeed (“\n”) and auto scroll. It would be very useful to be able to control the position of the cursor to print continuously in the same lines (overwriting) without making scroll. For example in a measurement sketch to print the results in several lines (the same lines without scroll) like in a LCD display.
This cursor control position can be done using the well-known VT100 escape sequences. I suggest a minimal implementation and an enhance one.
-
Minimal implementation (Carriage Return and Cursor Up one line)
It is enough for most of sketches. “\x1b” represents the Esc character.
“\n” or “\r\n” Line feed and Carriage Return (like is currently implemented).
“\r” Carriage Return without Linefeed
“\x1b[A” Moves the cursor one line up -
Enhance implementation (Full cursor control)
The previous minimal implementation plus the following escape sequences (N represents a decimal number):
“\x1b[NA” Moves the cursor N lines UP
“\x1b[NB” Moves the cursor N lines DOWN
“\x1b[NC” Moves the cursor forward by N columns
“\x1b[ND” Moves the cursor backwards by N columns
Thank you very much