Hardware :
Raspi3b+
10 Zoll Touch (1024x600)
8 Taster
4 Relais
2 Temperatursensoren (one Wire)
Programm:
(der code den ich gleich teilweise einfüge ist aus allen Programmiersprachen gemixt, sollte aber zum Verständnis beitragen )
Programm an, Bildschirm Schwarz, nur Temeraturanzeige Fühler 1, gpio ( mir jacke ich nehm mal 40 ) high
sind dann 62 Grad C erreicht gpio 40 auf low und gpio 38 auf high. Hauptprogramm start.
Oberfläche sieht so aus ( dank eines Forenusers hier der auch noch was abbekommt ) :
Code: Alles auswählen
import tkinter as tk
from functools import partial
def button_click(button):
if button["text"] == "Start":
button["text"] = "Stopp"
button["background"] = "red"
activebackground = "red"
else:
button["text"] = "Start"
button["background"] = "#00ff00"
activebackground = "#00ff00"
def create_button_pair(button_frame, row):
time_button = tk.Button(button_frame, text="2:00:00", bg="#ffffff", width=6, height=1, font=("arial", 46))
time_button.grid(row=row, column=0, padx=22, pady=12)
start_stop_button = tk.Button(button_frame, text="Start", bg="#00ff00", width=6, height=1, font=("arial", 46))
start_stop_button.grid(row=row, column=1, padx=65, pady=3)
start_stop_button['command'] = partial(button_click, start_stop_button)
return time_button, start_stop_button
def main():
root = tk.Tk()
root.wm_title("TR3000")
root.geometry("600x1024")
root.config(cursor="none")
# root.attributes('-fullscreen', True)
main_frame = tk.Frame(root, background="#000000", width=600, height=1024)
main_frame.grid(row=0, column=0, padx=0, pady=0)
button_frame = tk.Frame(main_frame, background="#000000")
button_frame.grid(row=1, column=0, padx=0, pady=20)
buttons = [create_button_pair(button_frame, row) for row in range(8)]
slider = tk.Scale(main_frame, from_=0, to=120, resolution=1, orient=tk.HORIZONTAL, length=500, font=("arial",22))
slider.set(120)
slider.grid(row=8, padx=0, pady=3)
root.mainloop()
if __name__ == '__main__':
main()
Ich tippe auf eine Zeit ( vor Start ) , stelle die Zeit über den Slider ein und gut ist.
Dazu kommt pro Start-Stopp - Button noch eine Abfrage ob der Taster auch aktiv ist, wenn nein ( also offen ) gpio 40 auf High.
Ist eine Zeit abgelaufen gpio 38 auf High ( Blinkend ) und Button Grün Blinkend .
Das ist alles, Erbitte Angebote,