Go Down

Topic: Serial. println(""""); (Read 738 times) previous topic - next topic

HULK

Is it possible to serial print the sign " ?
I need to use that sign in AT command but clearly not possible if i try with:

Serial.println("AT+CPMS="ME"");

halley

#1
Apr 20, 2009, 09:05 pm Last Edit: Apr 20, 2009, 09:08 pm by halley Reason: 1
When included in a string literal, a backslash means the next character is special.

Code: [Select]
Serial.println("AT+CPMS=[glow]\[/glow]"ME[glow]\[/glow]"");

\' for a single quote
\" for a double quote
\\ for a single backslash
\0 for a zero byte
\xFF for a byte with hex value 0xFF
\277 for a byte with octal value o277
\n for a newline
\t for a tab character

There's about ten others I'm too lazy to look up at the moment.  They're called escape sequences.  Only some of these are supported within character literals (those single-character strings in single quotes).

HULK

#2
Apr 20, 2009, 09:37 pm Last Edit: Apr 20, 2009, 09:38 pm by HULK Reason: 1
Thanks a lot, it works!

Think that information should be added to the arduino reference area.


halley

#3
Apr 20, 2009, 09:48 pm Last Edit: Apr 20, 2009, 09:49 pm by halley Reason: 1
Yes, maybe it probably should be in the reference area.  However, for some reason the Arduino site doesn't really call much attention to the fact that the language is just a plain vanilla world-wide standard C++. Perhaps to admit that fact would intimidate a lot of newcomers who have heard that C++ is hard or something.  Anyway, to really learn the language of Arduino development, you have a lot of good resources on C++ already out there, maybe even in your local bookstore.

Go Up