Go Down

Topic: Degrees Symbol on Serial Monitor (Read 2132 times) previous topic - next topic

xidanny95ix

Feb 25, 2016, 04:41 pm Last Edit: Feb 25, 2016, 04:53 pm by xidanny95ix
Hi all,

Thanks in advance if you can answer this for me!

Im using a temperature sensor and am just wanting to be able to put degrees symbol onto the serial monitor. I have tried the ASCII table printer located here :

https://www.arduino.cc/en/Tutorial/ASCIITable

but there doesnt seem to be degrees? Any help is appreciated.

Cheers,
Danny

ieee488

The degree symbol is 167 (decimal).

xidanny95ix

Hi,

I have tried 167 but it is just returning a weird symbol that looks like 2 S's over lapping? Can this not be done on a nano?

Cheers
Danny

xidanny95ix

No worries, I've sorted it, it is 176 in decimal :)

Thanks

ieee488

http://www.asciitable.com/   shows the degree symbol as 167 decimal, so I am not sure why you need 176


christop

ASCII doesn't have a degrees symbol. ASCII is a 7-bit code and is defined for only codes 0 through 127.

I believe the serial monitor uses the Windows-1252 character set, or possibly the ISO 8859-1 character set; the two are almost the same. The degrees symbol is at code 176 in both.

ninja2

#7
Jul 06, 2017, 10:27 am Last Edit: Jul 06, 2017, 10:43 am by ninja2
http://www.asciitable.com/   shows the degree symbol as 167 decimal, so I am not sure why you need 176
Believe it or not I reckon that table of Extended ASCII Codes on http://www.asciitable.com/ may actually be wrong.
Other ASCII tables (such as HTML linked in above post) list the degree symbol as 176 (Hex B0), and char(176) is the correct value for Arduino Serial printing degress symbol, not char(167)
 

ninja2

#8
Jul 06, 2017, 10:59 am Last Edit: Jul 06, 2017, 11:00 am by ninja2
PS: IDE 1.8.3 now uses UTF-8 charset, so coding syntax for degree symbol has changed

see this thread at post #20 onwards

Go Up