/Modules/Sensors/ALTIMET01A/SW/Python/data_logger.py
73,13 → 73,17
#### Data Logging ###################################################
 
sys.stdout.write("ALTIMET data acquisition system started \n")
ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
 
 
try:
with open("temperature.log", "a") as f:
while True:
sys.stdout.write("Start measurement now? [ENTER]")
sys.stdin.readline()
 
ser.write(':DISP?\n')
Prefstart = ser.readline(100)
 
gauge1.route()
(t1, p1) = gauge1.get_tp()
gauge2.route()
97,11 → 101,16
gauge8.route()
(t8, p8) = gauge8.get_tp()
 
sys.stdout.write(" Temperature: %.2f %.2f %.2f %.2f %.2f %.2f %.2f Pressure: %d %d %d %d %d %d %d Note: " % (t1, t2, t3, t4, t5, t6, t8, p1, p2, p3, p4, p5, p6, p8 ))
ser.write(':DISP?\n')
Prefstop = ser.readline(100)
 
sys.stdout.write(" Temperature: %.2f %.2f %.2f %.2f %.2f %.2f %.2f Pressure: %d %d %d %d %d %d %d %s %s Note: " % (t1, t2, t3, t4, t5, t6, t8, p1, p2, p3, p4, p5, p6, p8, Prefstart, Prefstop ))
note = sys.stdin.readline()
f.write("%d\t%s\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%s\n" % (time.time(), datetime.datetime.now().isoformat(),t1, t2, t3, t4, t5, t6, t8, p1, p2, p3, p4, p5, p6, p8, note, ))
f.write("%d\t%s\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%s\t%s\t%s\n" % (time.time(), datetime.datetime.now().isoformat(),t1, t2, t3, t4, t5, t6, t8, p1, p2, p3, p4, p5, p6, p8, Prefstart, Prefstop, note, ))
sys.stdout.flush()
time.sleep(0.5)
# time.sleep(0.5)
except KeyboardInterrupt:
ser.close()
sys.exit(0)