make some small changes

This commit is contained in:
Ryan Xu 2022-12-15 21:35:36 -08:00
parent 42994a7dd7
commit 41e3b99e05
1 changed files with 7 additions and 1 deletions

View File

@ -52,6 +52,12 @@ def read():
else:
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():
try:
read_data = controller.readline().decode("utf-8")