New library for controlling VT100/ANSI terminals

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 GitHub - nottwo/BasicTerm: Arduino library for basic ANSI/VT220 terminal control

Currently 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: BasicTerm/StatusMonitor.ino at master · nottwo/BasicTerm · GitHub

I'm interested in feedback on the library. Thanks for checking it out &
feel free to let me know what you think!

I haven't got time to play with it bit it seems like a good idea, as you say we do get people asking to do this sort of thing.


Rob

Could be a nice playground article !

robtillaart:
Could be a nice playground article !

Yes, that's a good idea. I will write something up.

Just now I found an older library that went part of the way I'm headed with BasicTerm: Arduino Playground - Xterm

Hello,

Thanks for this fine library.

I am writing a emulator for an very old programmable calculator (Olivetti PROGRAMMA 101)
As in and output I need a VT100 emulator running on a IMAC OS 10.7.
Does someone knows a good VT100 Terminal program (free) for the IMac?

Thanks,

Jan Kromhout
Hellevoetsluis-NL

Hoi Jan,

is this something that fit - The Best Terminal Emulator for Mac OS X -

[oostbrabant]

I used the library to talk to an old NIXDORF BA63 POS 2x20 VFD customer display, connected to UNO Tx pin. I sent commands to the VFD thru Poderosa terminal emulator, since Arduino Serial Monitor is not VT100 compatible. No problems so far.Many thanks for your share.

baxev2005:
I used the library to talk to an old NIXDORF BA63 POS 2x20 VFD customer display, connected to UNO Tx pin. I sent commands to the VFD thru Poderosa terminal emulator, since Arduino Serial Monitor is not VT100 compatible. No problems so far.Many thanks for your share.

I'm glad you found the library useful!

Do I understand correctly that you used Poderosa while you debugged your application since SerialMonitor doesn't support the VT100 escapes, and that the final application used the BA63 as an output device?

I'm not clear how a terminal emulator could help pass the display output to the BA63.

In any case, I welcome issues or pull requests on Github!

does it support VT220 block mode ?