pySerial write() won't take my string
In that post, coders explained how to use the
ser.write()
method.
I am still wondering how to use the
readline()
method in python3.x as I want to recieve a float, and compare it in my python 3.x code. I know how to use the readline() in python 2.7. But I am not able to get it working in 3.x.
import serial
import time
ser=serial.Serial('/dev/ttyACM0', 9600)
while 1:
ans = ser.readline()
print(ans)
if ans > 25.50:
print('its getting hot in here')
else:
print('Everything is fine')
Thanks in advance