SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By micko
#117491
Hey everyone,

I am trying to create a function in Arduino that moves the cursor in a terminal client. I have a function definition of:
void MoveCursor(uint8_t x, uint8_t y).

Can someone show me how to do something like this using Serial.Print() functions?

Regards
Michael
User avatar
By liudr
#117542
One needs more details than what you provided to help you. What's a terminal client? A PC? Are you trying to send a key press to it using Arduino?
By micko
#117634
Ok, for terminal clients, there are escape sequences that can manipulate the terminal in different ways(clear the terminal, clear the line, change the colour of the screen/font)
See: http://en.wikipedia.org/wiki/ANSI_escape_code

So for example, this is how I would clear the current line in a terminal using arduino:
Serial.print(27,BYTE);
Serial.print("[K");

I want to be able do the 'Cursor Position' command from that escape code list. Can someone please help me


Michael
User avatar
By liudr
#117643
That wiki page is hard for me. don't now why, maybe no experience with old terminals at all explains.

Will this work?

Serial.print(27,BYTE);
Serial.print("A");

Or maybe:

Serial.print(27,BYTE);
Serial.print(1,BYTE);
Serial.print("A");