import os import sys import tkinter as tk from tkinter import ttk import RPi.GPIO as GPIO # Add the parent directory to the module search path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from interface_board_libs.adc_mcp3208 import MCP3208 from interface_board_libs.shift_register import ShiftRegister from interface_board_pins import * # Import pin assignments from tab_control import create_control_tab from tab_adc_plot import create_adc_plot_tab from tab_digital_plot import create_digital_plot_tab # Initialize ADC & Shift Register adc = MCP3208() shift_reg = ShiftRegister(GPIO_SHIFT_REG_DATA, GPIO_SHIFT_REG_LATCH, GPIO_SHIFT_REG_CLOCK) # GPIO Setup GPIO.setmode(GPIO.BCM) for pin in GPIO_DIGITAL_INPUTS.values(): GPIO.setup(pin, GPIO.IN) GPIO.setup(GPIO_PWM1, GPIO.OUT) GPIO.setup(GPIO_PWM2, GPIO.OUT) pwm1 = GPIO.PWM(GPIO_PWM1, 1000) pwm2 = GPIO.PWM(GPIO_PWM2, 1000) pwm1.start(0) pwm2.start(0) # Tkinter GUI root = tk.Tk() root.title("Raspberry Pi Interface Board") root.attributes('-fullscreen', True) root.configure(bg="black") # Tabbed Interface notebook = ttk.Notebook(root) notebook.pack(expand=True, fill="both") # Add tabs create_control_tab(notebook, adc, shift_reg, pwm1, pwm2) create_adc_plot_tab(notebook, adc) create_digital_plot_tab(notebook) # Run GUI root.mainloop()