Shop OBEX P1 Docs P2 Docs Learn Events
How to?: Send VT100 command via FullDuplexSerialPlus object — Parallax Forums

How to?: Send VT100 command via FullDuplexSerialPlus object

SteveWoodroughSteveWoodrough Posts: 190
edited 2014-01-03 19:50 in General Discussion
Please excuse my ignorance. I tried searching this in Google and in the forum and came up empty. I need to send the VT 100 clear screen command to a terminal emulator. I am able to send text and numbers from my Prop via BT to my Android phone running the BlueTerm application.

I’m accustomed to sending serial data to an LCD where of course sending fds.tx(16) will clear the screen and home the cursor. That same approach does not work with BlueTerm. Apparently I need to transmit the VT100 command “ <ESC>[2J “ .

What would my FullDuplexSerialPlus method call look like? fds.tx(???)

Best Regards,
Steve

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2014-01-03 19:09
    Have you tried fds.str(string(27, "[2J"))?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-01-03 19:09
    Apparently I need to transmit the VT100 command “ <ESC>[2J “ .

    What would my FullDuplexSerialPlus method call look like? fds.tx(???)

    I'm pretty sure escape is ASCII character # 27.

    I think this would do it.
    ser.str(string(27,"[2J"))
    
  • SteveWoodroughSteveWoodrough Posts: 190
    edited 2014-01-03 19:15
    Thanks guys. I'll give it a go and report back.
    Steve
  • SteveWoodroughSteveWoodrough Posts: 190
    edited 2014-01-03 19:46
    Sweet!!! That works. I got a bunch of cheap $5 BT modules that I mounted on boards and an old phone. I can cram a lot more data at 115200 onto the phone display vs a 4 x20 LCD. This just opened up a whole lotta possibilities.

    Latest wireless vision project video:
    https://www.youtube.com/watch?v=UZe48U0K89k

    Regards,
    Steve
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2014-01-03 19:50
    Hi Steve;
    Here are a bunch of codes:
    ESC "[H"       REM Curser to Home
    ESC "[2J"      REM Erase Display
    ESC "[0K"      REM clear-eol
    ESC "[1K"      REM clear-bol
    ESC "[2K"      REM Erase Entire Line
    ESC "[3A"      REM ^  Curser Up 3
    ESC "[4B"      REM v  Curser Down 4
    ESC "[5C"      REM -> Curser Forward 5
    ESC "[6D"      REM <- Curser Backward  6
    ESC "[s"       REM Save Cursor Position
    ESC "[u"       REM Restore Cursor Position
    ESC "[0m"      REM Cursor Normal (Reset)
    ESC "[1m"      REM Bold
    ESC "[1;34m"   REM Bold Blue
    ESC "[30m"     REM Black
    ESC "[31m"     REM Red
    ESC "[32m"     REM Green
    ESC "[33m"     REM Yellow
    ESC "[34m"     REM Blue
    ESC "[35m"     REM Magenta
    ESC "[36m"     REM Cyan
    ESC "[37m"     REM White
    

    Duane J
Sign In or Register to comment.