Jan-16-2018, 02:04 PM
Hi, im a total newbie to this but here we go:
Got 6x MAX31855 running with code from https://github.com/Tuckie/max31855
I have managed to make a noob gui and "logging" directly to USB as a text file.
Now I also want to see the current temperatures displayed on the gui...
I've tried with some labels etc but cant get it working.
When looking at my program you see that i dont have a clue :)
Got 6x MAX31855 running with code from https://github.com/Tuckie/max31855
I have managed to make a noob gui and "logging" directly to USB as a text file.
Now I also want to see the current temperatures displayed on the gui...
I've tried with some labels etc but cant get it working.
When looking at my program you see that i dont have a clue :)
#!/usr/bin/python from tkinter import * import tkinter as tk from max31855 import MAX31855, MAX31855Error running = False import time import readline def scanning (): f = open('/media/pi/KINGSTON/LOGG', 'a') if running: cs_pins = [25, 8, 7, 5, 6, 12] clock_pin = 11 data_pin = 9 units = "c" thermocouples = [] for cs_pin in cs_pins: thermocouples.append(MAX31855(cs_pin, clock_pin, data_pin, units)) meh = True if (meh): try: for thermocouple in thermocouples: rj = thermocouple.get_rj() try: tc = thermocouple.get() except MAX31855Error as e: tc = "Error: "+ e.value meh = False print ("Sensor: {} *C".format(tc)) print (f.write("Sensor: {} *C".format(tc))), (f.write(" kl. ")), (f.write(time.strftime("%H:%M:%S\n"))) time.sleep(1) except (Stopped): meh = False for thermocouple in thermocouples: thermocouple.cleanup() root.after(1000, scanning) def start(): f = open('/media/pi/KINGSTON/LOGG', 'a') #enable logging# global running running = True print (f.write("-------------------------------\n")) print (f.write("Logging har startet\n")) print (f.write("\n")) print (f.write(time.strftime("%H:%M:%S\n"))) print (f.write(time.strftime("%d/%m/%Y\n"))) print (f.write("-------------------------------\n")) start['state'] = DISABLED stop['state'] = NORMAL def stop(): f = open('/media/pi/KINGSTON/LOGG', 'a') #disable logging# global running running = False print (f.write("-------------------------------\n")) print (f.write("Logging avsluttet\n")) print (f.write("\n")) print (f.write(time.strftime("%H:%M:%S\n"))) print (f.write(time.strftime("%d/%m/%Y\n"))) start['state'] = NORMAL stop['state'] = DISABLED root = tk.Tk() root.title("Temperaturlogging") root.geometry("500x500") app = Frame(root) app.grid() start = Button(app, text="Start Logging", width=40, height=8, background="green", command=start) stop = Button(app, text="Stopp Logging", width=40, height=8, background="yellow", command=stop) start.grid(row=1, column=3) stop.grid(row=2, column=3) stop['state'] = DISABLED root.after(1000, scanning) root.mainloop()