Go Down

Topic: Other Serial.print special characters? (Read 2201 times) previous topic - next topic

george_graves

Dec 31, 2010, 10:46 am Last Edit: Dec 31, 2010, 10:47 am by george_graves Reason: 1
I noticed that serial.print has a special character for tabbing.

 Serial.println("\t");

Are there any others?  I thought it might be nice for making debug pretty.

I ran the alphabet and the complier accepted these

 Serial.println("\a");
 Serial.println("\b");
 Serial.println("\v");

I have no clue what it spits out.  The debug window gave me junk that's I can't get to show up in the fourm.

Is there a list? Is these a carriage return?  Others?

thanks in advance!

gg

Coding Badly


There are "special characters" but what's important is the receiving side.  That's where the characters are interpreted.  From the sender's perspective, they are just 8 bit values.

What are you using?  Serial Monitor?

"\r" is carriage-return.
"\n" is line-feed.

I believe Serial Monitor interprets "\r\n" as "advance to the next line".

MikMo

#2
Dec 31, 2010, 10:56 am Last Edit: Dec 31, 2010, 10:59 am by MikMo Reason: 1
Here's a list of the commonly used escape chars in C programming.

http://msdn.microsoft.com/en-us/library/h21280bw%28v=vs.80%29.aspx

I don't know if all of them are implemented on the Arduino.

EDIT:

Of course those that has to do with UNICODE chars are not implemented on Arduino.

Go Up