Jun-08-2019, 06:34 PM
Greetings
I'm new to Python and I wrote a little program and I get an error meseg:
Thanks
miki
I'm new to Python and I wrote a little program and I get an error meseg:
Error:Traceback (most recent call last):
File "C: / Users / micha / Downloads / arduino-python project / ultrasonic sensor", line 11
distance = float (myData)
ValueError: could not convert string to float
Can someone explain to me why I'm not doing okay?Thanks
miki
import serial from visual import * arduinoSerialData = serial.Serial('com5', 9600) measuringRod = cylinder( title="My Meter", radius= .5, length=6, color=color.yellow, pos=(-3,0,0)) while (1==1): rate(20) if (arduinoSerialData.inWaiting()>0): myData = arduinoSerialData.readline() print myData distance = float(myData) measuringRod.length=distance