Jun-03-2022, 06:41 PM
(This post was last modified: Jun-04-2022, 01:07 PM by deanhystad.)
This gets a str object:
You should do this:
arduinoData = ser.readline().decode('ascii')This tries to divide the str by 5
data = (arduinoData)/5Dividing a str by an int raises a TypeError which is caught by the overly broad except: Your program prints "fail" every time, no matter what is read
You should do this:
data = float(arduinoData)/5This might also fail, but if arduinoData is a string that can be interpreted as a float, it will succeed.