Pages: [1]   Go Down
Author Topic: Serial. println("""");  (Read 588 times)
0 Members and 1 Guest are viewing this topic.
Sweden, Malmö
Offline Offline
Full Member
***
Karma: 2
Posts: 200
Rooky
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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"");
Logged

Connecticut, US
Offline Offline
Edison Member
*
Karma: 2
Posts: 1036
Whatduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

When included in a string literal, a backslash means the next character is special.

Code:
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).
« Last Edit: April 20, 2009, 02:08:54 pm by halley » Logged

Sweden, Malmö
Offline Offline
Full Member
***
Karma: 2
Posts: 200
Rooky
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot, it works!

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

« Last Edit: April 20, 2009, 02:38:09 pm by HULK » Logged

Connecticut, US
Offline Offline
Edison Member
*
Karma: 2
Posts: 1036
Whatduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: April 20, 2009, 02:49:53 pm by halley » Logged

Pages: [1]   Go Up
Jump to: