Hello.
could you be so kind as to explain with more detail de line of code (Microython ESP32 and ESP8266 page261:
msg = (b'{0:3.1f}’.format(temp))
.why the outer parentesis?
{0:3.1f} is some kind of diccionary entry?
what does de .fomat(temp) method do?
so sorry if my questions make little sense but I’m just starting
thanks in advance
Hi.
{0:3.1f} is a way of formatting number (in this case, the temperature value).
f for float; 3 for the total number of places to be reserved for the whole string, 1 for the decimal places.
For a more detailed explanation, I recommend reading this article:
As for the b’, it converts the value into bytes literal. This article explains it well for beginners:
I hope this helps.
Regards,
Sara