Skip to content
Snippets Groups Projects
Commit 401d4b9e authored by FrankR's avatar FrankR
Browse files

Versuch Index-out-of-range Exception in get_distance-Funktion zu beheben

parent cc2ead24
No related branches found
No related tags found
No related merge requests found
......@@ -39,8 +39,9 @@ def read_serial(number):
for x in range(number):
line = ser.readline() # read a '\n' terminated line
print(line)
if(len(line)>30):
tag, distance = get_distance(line.decode("utf-8"))
line_decoded = line.decode("utf-8");
if(len(line_decoded)>=4):
tag, distance = get_distance(line_decoded);
print(tag, distance)
if (tag == "3383"):
d1.append(float(distance))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment