Adelaide, South Australia
Offline
Full Member
Karma: 0
Posts: 135
Arduino rocks
|
 |
« on: April 02, 2012, 04:36:47 pm » |
Where can I find a list of all the special characters for char arrays and printing, like \n, \o and similar
Also how would I print the little superscripted 'o' symbol for degrees C or F, e.g. in 27<degrees symbol>C
TIA
|
|
|
|
|
Logged
|
|
|
|
|
West Des Moines, Iowa USA
Offline
Sr. Member
Karma: 2
Posts: 429
|
 |
« Reply #1 on: April 02, 2012, 06:26:51 pm » |
From The C Programming Language:
\a alert (bell) character \b backspace \f formfeed \n newline (linefeed) \r carriage return \t horizontal tab \v vertical tab \\ backslash \? question mark \' single quote \ddd octal constant \xhh hexadecimal constant
The degree symbol (as in 27°C) is unknown to C and (I think) C++ and printing it will probably involve device dependencies.
|
|
|
|
|
Logged
|
There's always a better way!
|
|
|
|
alabama
Offline
Full Member
Karma: 1
Posts: 168
|
 |
« Reply #2 on: April 02, 2012, 07:38:49 pm » |
Ninja2, Try this page, you can even create your own custom character. http://www.quinapalus.com/hd44780udg.htmlTomJ
|
|
|
|
|
Logged
|
Einstein once said you don't really understand anything until you can explain it to your Grandmother
|
|
|
|
alabama
Offline
Full Member
Karma: 1
Posts: 168
|
 |
« Reply #3 on: April 02, 2012, 08:07:01 pm » |
Ninja2, Just read a way to print the degree symbol on another post. It's at the bottom of the alternative code for averaging. http://arduino.cc/forum/index.php/topic,99557.0.htmlTomJ
|
|
|
|
|
Logged
|
Einstein once said you don't really understand anything until you can explain it to your Grandmother
|
|
|
|
Adelaide, South Australia
Offline
Full Member
Karma: 0
Posts: 135
Arduino rocks
|
 |
« Reply #4 on: April 03, 2012, 05:35:37 am » |
excellent help, thanks all I must use/learn that list of backslash codes ... found the magic syntax too ... lcd.print((char)223); // degree yeeha ... great forum, friendly players, top advice, fascinating topic(s) 
|
|
|
|
« Last Edit: April 03, 2012, 02:04:23 pm by ninja2 »
|
Logged
|
|
|
|
|
Adelaide, South Australia
Offline
Full Member
Karma: 0
Posts: 135
Arduino rocks
|
 |
« Reply #5 on: April 03, 2012, 02:02:07 pm » |
The degree symbol (as in 27°C) ... Morris - how did you insert / type the degree symbol into your text above ?
|
|
|
|
|
Logged
|
|
|
|
|
West Des Moines, Iowa USA
Offline
Sr. Member
Karma: 2
Posts: 429
|
 |
« Reply #6 on: April 03, 2012, 02:48:05 pm » |
On this keyboard the degree symbol is shift+option+8 (An * that's turned into a ° by the option key).
You can do the same thing on a Windows keyboard by holding down the Alt key and typing in a code on the numeric keypad - but I've already forgotten the code. :-(
|
|
|
|
|
Logged
|
There's always a better way!
|
|
|
|
Adelaide, South Australia
Offline
Full Member
Karma: 0
Posts: 135
Arduino rocks
|
 |
« Reply #7 on: April 04, 2012, 06:54:32 am » |
º how about alt+0186 º  ºXºXºXº google is so amazing these days, I just googled "How to type degree symbol on PC" and bingo
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5938
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #8 on: April 04, 2012, 04:15:04 pm » |
º how about alt+0186 º  ºXºXºXº google is so amazing these days, I just googled "How to type degree symbol on PC" and bingo Next day Google will push books ad to you that features a whole chapter on "How to type degree symbol on PC" 
|
|
|
|
|
Logged
|
|
|
|
|
West Des Moines, Iowa USA
Offline
Sr. Member
Karma: 2
Posts: 429
|
 |
« Reply #9 on: April 04, 2012, 04:35:43 pm » |
If the Extended ASCII code is 233, then you should be able to embed it in a string as
char *temperature = "Today's high temperature is 27\xE9""C"
But my wimpy bash terminal window displays it as a question mark. :-/
|
|
|
|
|
Logged
|
There's always a better way!
|
|
|
|
the land of sun+snow
Offline
Edison Member
Karma: 81
Posts: 2134
|
 |
« Reply #10 on: April 06, 2012, 12:47:32 pm » |
from Morris: \n newline (linefeed) \r carriage return
I assume \r sends only a 13, but does \n send only a 10, or both 10 + 13?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 316
Posts: 35535
Seattle, WA USA
|
 |
« Reply #11 on: April 06, 2012, 01:09:20 pm » |
I assume \r sends only a 13, but does \n send only a 10, or both 10 + 13? Depends on what is doing the sending, on what operating system.
|
|
|
|
|
Logged
|
|
|
|
|
the land of sun+snow
Offline
Edison Member
Karma: 81
Posts: 2134
|
 |
« Reply #12 on: April 06, 2012, 02:47:38 pm » |
Depends on what is doing the sending, on what operating system.
How about this one: Serial.print("\n");
|
|
|
|
|
Logged
|
|
|
|
|
Adelaide, South Australia
Offline
Full Member
Karma: 0
Posts: 135
Arduino rocks
|
 |
« Reply #13 on: April 06, 2012, 03:27:55 pm » |
Next day Google will push books ad to you that features a whole chapter on "How to type degree symbol on PC"  LOL , and I'm a the perfect target for such 
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 316
Posts: 35535
Seattle, WA USA
|
 |
« Reply #14 on: April 06, 2012, 04:57:41 pm » |
How about this one: Serial.print("\n"); Sends exactly one byte - the new line value, 10. to the serial port.
|
|
|
|
|
Logged
|
|
|
|
|
|