|
Post by brunovr on Feb 7, 2014 13:18:02 GMT -8
Hi, is possible to know the Character map ?
I want to write °C ! How ca i do to write the ° ?
Thank's
|
|
|
Post by jamesbowman on Feb 7, 2014 16:05:45 GMT -8
There's no "degree" symbol in the built-in character maps. They only have the plain ASCII set. But there are many ways of getting the symbol. Here is a simple hack -use a lower-case "o" in a smaller font: static void degrees_c(int x, int y, int d) { GD.cmd_number(x, y, 31, OPT_RIGHTX, d); GD.cmd_text(x + 4, y, 28, 0, "o"); GD.cmd_text(x + 6, y, 31, 0, " C"); }
So degrees(100, 100, 27) gives
|
|
|
Post by brunovr on Feb 8, 2014 2:37:13 GMT -8
WOW ! yes, it's a good idea !!!! :-)
Only another question : If i want to see 25,4 decimal degree can i convert to text or there is another simple way ? and if is negative -0,4 i can use the OPT_SIGNED for negative and for decimal degree? ciao ciao
|
|
|
Post by mathiasw on Feb 8, 2014 3:39:05 GMT -8
Salut,
I always use sprintf to write my data into a string which I then output. It gives me the best formatting options
Ciao, Mathias
|
|
|
Post by jamesbowman on Feb 8, 2014 14:51:13 GMT -8
Right, cmd_number() is integers only (optionally signed with OPT_SIGNED).
For anything fancier sprintf() and cmd_text() are required.
|
|
|
Post by wetherman on Aug 5, 2015 12:22:03 GMT -8
The standard Arduino sprintf does not know the %f format spec for floats with decimal places. I use dtostrf instead, and that saves the program space taken up by the printf family of string manipulation functions. Then as James said you have to use cmd_text() to put it on the screen.
|
|