#!/usr/bin/env python import sys, time, os from datetime import datetime as dt import numpy as np t0=0 t1=0 # =========== this routime finds the 2 USBtemperature probes ======= # ============== it sets up t0_read and t1_read ==================== #+++++++++++++++++++++++++++++++++++++++++++++++++++++ stream = os.popen("./try0") tmp = stream.read() temperature = float(tmp[0:5]) print("try0=%s %f\n" %(tmp[0:5],temperature)) if(temperature != 0.0): print("GOOD\n") if(t0==0): stream = os.popen("cp try0 t0_read") t0=1 #+++++++++++++++++++++++++++++++++++++++++++++++++++++ stream = os.popen("./try1") tmp = stream.read() temperature = float(tmp[0:5]) print("try1=%s %f\n" %(tmp[0:5],temperature)) if(temperature != 0.0): print("GOOD\n") if(t0==1): stream = os.popen("cp try1 t1_read") if(t0==0): stream = os.popen("cp try1 t0_read") t0=1 print("GOOD %d %d\n" %(t0,t1)) #+++++++++++++++++++++++++++++++++++++++++++++++++++++ stream = os.popen("./try2") tmp = stream.read() temperature = float(tmp[0:5]) print("try2=%s %f\n" %(tmp[0:5],temperature)) if(temperature != 0.0): if(t0==1): stream = os.popen("cp try2 t1_read") t1=1 if(t0==0): stream = os.popen("cp try2 t0_read") t0=1 print("GOOD %d %d\n" %(t0,t1)) #+++++++++++++++++++++++++++++++++++++++++++++++++++++ stream = os.popen("./try3") tmp = stream.read() temperature = float(tmp[0:5]) print("try3=%s %f\n" %(tmp[0:5],temperature)) if(temperature != 0.0): if(t0==1): stream = os.popen("cp try3 t1_read") t1=1 if(t0==0): stream = os.popen("cp try3 t0_read") t0=1 print("GOOD %d %d\n" %(t0,t1)) #+++++++++++++++++++++++++++++++++++++++++++++++++++++ stream = os.popen("./try4") tmp = stream.read() temperature = float(tmp[0:5]) print("try4=%s %f\n" %(tmp[0:5],temperature)) if(temperature != 0.0): if(t0==1): stream = os.popen("cp try4 t1_read") t1=1 if(t0==0): stream = os.popen("cp try4 t0_read") t0=1 print("GOOD %d %d\n" %(t0,t1)) #+++++++++++++++++++++++++++++++++++++++++++++++++++++ stream = os.popen("./try5") tmp = stream.read() temperature = float(tmp[0:5]) print("try5=%s %f\n" %(tmp[0:5],temperature)) if(temperature != 0.0): if(t0==1): stream = os.popen("cp try5 t1_read") t1=1 if(t0==0): stream = os.popen("cp try5 t0_read") t0=1 print("GOOD %d %d\n" %(t0,t1)) #+++++++++++++++++++++++++++++++++++++++++++++++++++++ if(t0==0): print(" =============== ERROR not USBTherno found =================\n") exit(0) #+++++++++++++++++++++++++++++++++++++++++++++++++++++ if(t1==0): stream = os.popen("cp t0_read t1_read") print(" ERROR only one thermo found using it twice\n") exit