seems that i discovered something that looks like a bug in MicroPython (v1.16.uf2), there's a random corruption
shown in the text printed to the terminal when using UTF-8
Since i'm too new with arm microcontrollers and Micropython i can't do much research on how and why
this happens but i've noticed the corrupted text only appear in the terminal and not if you try to save it
in a file where it appears normal.
there was a discussion going on on another forum and a member could confirm the issue too
by running the same code i'm posting bellow, he is also member here so he can jump into
this thread if he wants to say more about it.
Code: Select all
import machine
import utime
led = machine.Pin(25, machine.Pin.OUT)
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)
while True:
reading = sensor_temp.read_u16() * conversion_factor
temperature = 27 - (reading - 0.706)/0.001721
print ("\u0398\u03B5\u03C1\u03BC\u03BF\u03BA\u03C1\u03B1\u03C3\u03AF\u03B1",int(temperature,),end="\r")
led.high()
temp_file = 'temp.txt'
f = open(temp_file, 'a')
b = str(temperature)
f.write("\u0398\u03B5\u03C1\u03BC\u03BF\u03BA\u03C1\u03B1\u03C3\u03AF\u03B1 "+ b + '\n')
f.close()
led.low()
utime.sleep(7)