Hello, People
I have the following code in Arduino
if((digitalRead(4) != 1)||(digitalRead(5) != 1))
{
Serial.print("\t");
Serial.print(analogRead(A0));
Serial.print(",");
Serial.print(millis());
Serial.print("\n");
}
And with it, I read in Python with the following code:
def leituraSerial():
tempo_leitura = time.time() + (TIMER + 1.6) # Contador de TIMER segundos
k = 0
while(time.time() <= tempo_leitura):
print("\n Leitura Iniciada!")
aux = entrada.readline()
str(aux)
print(aux.decode('ascii'))
I tried several encodings of cp1252, windows-1250, utf-8, latin_1 and so on .. some return \ x00 with the value I wanted, others give error, the way code is above, it runs, however I add, for example:
ts, tp = aux.split(",")
I already get the following error:
'ascii' codec can't decode byte 0xfe in position 8: ordinal not in range(128)
If you use utf-8:
'utf-8' codec can't decode byte 0xfd in position 6: invalid start byte
So what the heck is going on?