Hi folks,
Every so often a thread comes up asking how to position text on the SerialMonitor in a consistent place to get away from the pages of scrolling text. The answer is always, "Use VT100/ANSI escapes" and "Use a real terminal emulator instead of SerialMonitor". I'm still looking into upgrading SerialMonitor into a real terminal emulator, but I'd like to announce a convenient way to use VT100/ANSI escapes.
I've implemented a simple library for controlling ANSI/VT100/VT220 terminals over the serial port. It delegates reading & writing to a Stream device, so it should be usable with SoftSerial or even I2C, although it has only been used with HardwareSerial so far. It's in a useful state, but there is still more to be done.
It's available at
http://github.com/nottwo/BasicTermCurrently implemented:
* clearing the screen
* positioning the cursor
* setting NORMAL, BOLD, UNDERLINE, BLINK & REVERSE character attributes
* setting foreground & background colors from the standard 8 color palette
* reading arrow & function keys (F1 - F4)
Still in the pipeline:
* expanded function key reading
* blocking reads & reads w/ timeout
* graphical character drawing
Here's an example of a top(1)-like Arduino status monitor sketch:
https://github.com/nottwo/BasicTerm/blob/master/examples/StatusMonitor/StatusMonitor.inoI'm interested in feedback on the library. Thanks for checking it out &
feel free to let me know what you think!