From 8dd97524e9ac2dab6878dfb9470b48ed78370174 Mon Sep 17 00:00:00 2001 From: James Gao Date: Sat, 18 Oct 2014 12:43:41 -0700 Subject: [PATCH] add temperature logging with a file --- kiln/bisque_firing_06.py | 14 ++++++++++++++ kiln/thermo.py | 4 ++++ 2 files changed, 18 insertions(+) create mode 100644 kiln/bisque_firing_06.py diff --git a/kiln/bisque_firing_06.py b/kiln/bisque_firing_06.py new file mode 100644 index 0000000..2765d7b --- /dev/null +++ b/kiln/bisque_firing_06.py @@ -0,0 +1,14 @@ +import manager +import thermo +import sys + +if __name__ == "__main__": + start_time = None + if len(sys.argv) > 1: + start_time = float(sys.argv[1]) + schedule = [[2*60*60, 176], [4*60*60, 620], [6*60*60, 1013], [6*60*60+20*60, 1013]] + mon = thermo.Monitor() + mon.start() + #schedule = [[20, 176], [40, 620], [60, 1013]] + kiln = manager.KilnController(schedule, mon, start_time=start_time, simulate=False) + kiln.run() \ No newline at end of file diff --git a/kiln/thermo.py b/kiln/thermo.py index 3f3c211..d7579fa 100644 --- a/kiln/thermo.py +++ b/kiln/thermo.py @@ -59,12 +59,16 @@ class Monitor(threading.Thread): return self.history[-1][1] def run(self): + with open("/home/pi/data.txt", "w") as f: + f.write("time\ttemp\n") while self.running: temp = self._read_temp() now = time.time() self.history.append((now, temp)) if self.callback is not None: self.callback(now, temp) + with open("/home/pi/data.txt", "a") as f: + f.write("%f\t%f\n"%(now, temp)) if self.display is not None: if temp > 50: