Commit 9716a50a authored by Stefan Steinmüller's avatar Stefan Steinmüller
Browse files

disabled writing to logfile and removed printouts. also fixed it for python3

parent a0e89b2a
......@@ -28,7 +28,7 @@ ax_4_l, = ax_4.plot([],[], 'yo')
try:
board = serial.Serial("/dev/ttyACM1", 115200, timeout=0.1)
board = serial.Serial("/dev/ttyACM1", 115200, timeout=1/200.0)
except Exception as e:
print("an error occured while opening the serial device\n{}".format(e))
exit()
......@@ -42,9 +42,10 @@ while board:
pass
except:
max_range = 0
_txt = board.readline().strip('\r\n')
_txt = board.readline().decode().strip('\\r\\n')
# print(_txt)
txt = _txt.split(",")
print(txt)
# print(txt)
x_range.append(max_range+1)
max_range += 1
try:
......@@ -59,20 +60,20 @@ while board:
ax_4.plot([max_range], [float(txt[3].strip())], 'yo')
csv_cont = []
try:
with open('log_plot.csv', 'r') as csv:
csv_cont = csv.readlines()
except:
pass
with open('log_plot.csv', 'w') as csv:
csv_cont.append(_txt)
csv.writelines(csv_cont)
# try:
# with open('log_plot.csv', 'r') as csv:
# csv_cont = csv.readlines()
# except:
# pass
# with open('log_plot.csv', 'w') as csv:
# csv_cont.append(_txt)
# csv.writelines(csv_cont)
except:
pass
#ani = FuncAnimation(fig, add_points, frames=200)
plt.pause(0.05)
plt.pause(1/200.0)
#plt.show()
plt.draw()
# plt.draw()
fig.canvas.draw()
fig.canvas.flush_events()
#ani = FuncAnimation(fig, add_points)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment