from PeachyGrapher import PeachyGrapher logCount = 1 graphMin = 50 graphLastMax = 0 mesageCount = 0 firstLogString = "logCount, maxPower, date and Time" logFile = open('logFile.csv', 'a') logFile.write(firstLogString) print("logged: " + firstLogString) logFile.close() grapher4 = PeachyGrapher(numlines=3) #grapher2=PeachyGrapher(title='TITLE',xlabel='XXX',ylabel='YYY',graphsize=20,numlines=1,legend=["string legend"],padding=2) while True: ##mesageCount += 1 if heardEnter() == True: logString = str(logCount) + "," + str( graphLastMax) + "," + time.strftime("%Y:%m:%d:%H:%M:%S") + "\n" logFile = open('logFile.csv', 'a') logFile.write(logString) logFile.close() print("logged: " + logString) graphLastMax = 0 logCount += 1 mesage = int(str(ser.readline().split(',')[0]))
if self.writeLog & (len(split_msg)>3): self.logFid.write(msg+"\n") self.logFid.flush() try: self.temps.append(float(split_msg[2])) except: print "tried to graph not an int" return split_msg def save_exit(): print "Exiting Cleanly and saving graph" grapher.saveGraph("reflow.png") if __name__=="__main__": logger=ReflowLogger() grapher=PeachyGrapher(title="Reflow Curve",xlabel="seconds (s)",ylabel="Temperature (C)") connectionStatus=logger.connect() atexit.register(save_exit) while(connectionStatus): msg=logger.readSerial() if (len(msg)==4): try: if float(msg[2])<500: grapher.addPoint(float(msg[2])) #grapher.saveGraph("reflow.png") else: print "Got Bad result, Thermal Couple Die again?" except: print "Bad Graphing Line" print msg time.sleep(0.1)