25 lines
403 B
Python
25 lines
403 B
Python
import serial as s
|
|
import datetime
|
|
|
|
ser=s.Serial()
|
|
ser.baudrate = 9600
|
|
ser.port = "COM5"
|
|
ser.timeout=10
|
|
|
|
ser.open()
|
|
f=open('datas.csv','w')
|
|
|
|
for uwu in range(0,10) :
|
|
x = ser.readline()
|
|
t = datetime.datetime.now()
|
|
|
|
f.write(str(x))
|
|
f.write("; ")
|
|
f.write(str(t))
|
|
f.write("\n")
|
|
print("Écriture de la ligne " + str(uwu+1))
|
|
|
|
print("écriture finie")
|
|
f.close()
|
|
ser.close()
|