Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Terminal escape sequences (Read 1917 times)
BigAl66
Newbies
*
Offline


Posts: 5
Joined: Jun 13th, 2017
Terminal escape sequences
Jun 13th, 2017 at 12:39pm
Print Post  
Hi there,

I try to use the escape sequence "\r" in the terminal to move the cursor to the begin of the current line. This does't work. CStr is active. According to the release notes this should word.

What I'm doing wrong?

My example code:

Code (C++)
Select All
void setup()
{
  Serial.begin(9600);
  delay(1000);
}

long test = 0;

void loop()
{
  test++;
  Serial.print(test);
  Serial.print("\r");
  delay(1000);
}
 



Sorry: I'm using Visual Studio 2015 and VMICRO, both in the most current version. I try it on an Arduino nano...

Thanks in advance!

Regards from Germany

Alex  Smiley
« Last Edit: Jun 13th, 2017 at 12:41pm by BigAl66 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12201
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Terminal escape sequences
Reply #1 - Jun 13th, 2017 at 2:15pm
Print Post  
Hi

The "terminal" works the same way as the arduino ide in as much as it is a forward only output.

Your code should cause a new line after the test data, therefore the next print will be on the next line.

Notes ...

Generally \n is better than a single \r or \r\n. Normally you can simply use println() instead of print

Serial.println(test);

or

Serial.print(test);
Serial.println();

or

Serial.print(test);
Serial.print("\r\n");

or

Serial.print(test);
Serial.print("\n");

  
Back to top
IP Logged
 
BigAl66
Newbies
*
Offline


Posts: 5
Joined: Jun 13th, 2017
Re: Terminal escape sequences
Reply #2 - Jun 13th, 2017 at 6:40pm
Print Post  
Hi,

that the \r in the Arduino IDE is not working is a known bug that will be fixed in the future (this info can be found in the Arduino forum).

Many people use e.g. putty to get a correct working terminal. But this is very circumstantial. I had the hope, that a third party product will work as expected and do not copy the neglects of the original Arduino IDE.  Wink

Alex
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12201
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Terminal escape sequences
Reply #3 - Jun 13th, 2017 at 9:32pm
Print Post  
Hi,

It's not a neglect for people who just want a new line. println() is best.

There have been some requests for some additional terminal options so they are certainly on the list.

Thanks

btw: cstr stuff relates to outbound from pc to arduino only.
« Last Edit: Jun 13th, 2017 at 9:34pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint