How to get the Degree Sign (chr176) in Micropython?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
holger
Posts: 3
Joined: Sun Dec 18, 2016 9:35 pm

How to get the Degree Sign (chr176) in Micropython?

Post by holger » Thu Jun 07, 2018 3:24 pm

Hello Folks,
i stuck in display the ° Sign in Micropython on an ESP8266. Python 3.5 converted by typing "print(chr(176))" the degree sign well. But with micropython 1.9.4 and the fork from loboris for the ESP32 i got the message: "recv unexpected word."

Any solutions?

Kind regards,

Holger

User avatar
pythoncoder
Posts: 2967
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: How to get the Degree Sign (chr176) in Micropython?

Post by pythoncoder » Sat Jun 09, 2018 9:02 am

This works on standard MicroPython (tested on Unix build and on Pyboard). So it looks like an issue specific to the Loboris port. I suggest you raise it either on GitHub or on the Loboris forum.

Code: Select all

MicroPython v1.9.4-131-gb789c64 on 2018-06-07; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> print(chr(176))
°
>>> 
Peter Hinch

loboris
Posts: 268
Joined: Fri Oct 02, 2015 6:19 pm

Re: How to get the Degree Sign (chr176) in Micropython?

Post by loboris » Sat Jun 09, 2018 9:02 pm

holger wrote:
Thu Jun 07, 2018 3:24 pm
Hello Folks,
i stuck in display the ° Sign in Micropython on an ESP8266. Python 3.5 converted by typing "print(chr(176))" the degree sign well. But with micropython 1.9.4 and the fork from loboris for the ESP32 i got the message: "recv unexpected word."
It works without issues:

Code: Select all

MicroPython ESP32_LoBo_v3.2.18 - 2018-06-04 on ESP32 board with ESP32
Type "help()" for more information.
>>> print(chr(176))
°
>>> 
The displayed character may depend on terminal emulator used.
How are you connected to the board?

holger
Posts: 3
Joined: Sun Dec 18, 2016 9:35 pm

Re: How to get the Degree Sign (chr176) in Micropython?

Post by holger » Sun Jun 10, 2018 9:59 am

You are right. Its a Problem with my terminal. I use uPycraft and on print(chr(176)) i got the reply "recv unexpected word." With putty "print(chr(176)) works well.

Post Reply