make some small changes
This commit is contained in:
parent
42994a7dd7
commit
41e3b99e05
|
@ -51,7 +51,13 @@ def read():
|
||||||
exit(0)
|
exit(0)
|
||||||
else:
|
else:
|
||||||
controller = serial.Serial(port, baudrate=baud)
|
controller = serial.Serial(port, baudrate=baud)
|
||||||
|
|
||||||
|
# open the file and add a line of header to it, then close
|
||||||
|
f = open(file_name, "a", newline="", encoding="utf-8")
|
||||||
|
writer = csv.writer(f)
|
||||||
|
header = ['Time', 'Resistance']
|
||||||
|
writer.writerow(header)
|
||||||
|
f.close()
|
||||||
while controller.isOpen():
|
while controller.isOpen():
|
||||||
try:
|
try:
|
||||||
read_data = controller.readline().decode("utf-8")
|
read_data = controller.readline().decode("utf-8")
|
||||||
|
|
Loading…
Reference in New Issue