forked from zietzm/Helmholtz_Test_Bench
user interface work
This commit is contained in:
1 parent
0dfa013606
commit
91de7f7240
12 files changed
+88
-21
No files matched your search
Binary file not shown.
Binary file not shown.
+15
-7
@@ -5,17 +5,25 @@ from Arduino import Arduino
|
||||
print("Searching for Arduino...")
|
||||
board = Arduino()
|
||||
print("Arduino found.")
|
||||
board.pinMode(9, "Output")
|
||||
board.pinMode(15, "Output")
|
||||
board.pinMode(16, "Output")
|
||||
board.pinMode(17, "Output")
|
||||
board.digitalWrite(15, "LOW")
|
||||
board.digitalWrite(16, "LOW")
|
||||
board.digitalWrite(17, "LOW")
|
||||
|
||||
|
||||
i = 0
|
||||
while i <= 4:
|
||||
while i <= 1:
|
||||
print("running: ", i)
|
||||
board.digitalWrite(9, "HIGH")
|
||||
for var in [15,16,17]:
|
||||
board.digitalWrite(var, "HIGH")
|
||||
time.sleep(0.5)
|
||||
time.sleep(1)
|
||||
board.digitalWrite(9, "LOW")
|
||||
time.sleep(0.5)
|
||||
time.sleep(1)
|
||||
time.sleep(5)
|
||||
for var in [15,16,17]:
|
||||
board.digitalWrite(var, "LOW")
|
||||
time.sleep(0.5)
|
||||
time.sleep(2)
|
||||
i = i + 1
|
||||
|
||||
board.close()
|
||||
@@ -0,0 +1,28 @@
|
||||
from tkinter import *
|
||||
|
||||
|
||||
class EmptyFrame:
|
||||
|
||||
def __init__(self, window):
|
||||
frame = Frame(window, width=1000, height=600)
|
||||
frame.pack()
|
||||
|
||||
one = Label(frame, text="One", bg="red")
|
||||
one.pack(fill=X)
|
||||
two = Label(frame, text="Two", bg="blue")
|
||||
two.pack()
|
||||
|
||||
|
||||
class TopMenu:
|
||||
|
||||
def __init__(self, window):
|
||||
menu = Menu(window)
|
||||
window.config(menu=menu)
|
||||
|
||||
ModeSelector = Menu(menu)
|
||||
menu.add_cascade(label="Mode", menu=ModeSelector)
|
||||
ModeSelector.add_command(label="Full Manual", command=self.manual_mode(window))
|
||||
|
||||
def manual_mode(self, window):
|
||||
print("Switching to manual mode")
|
||||
window.delete(ALL)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,11 @@
|
||||
import numpy as np
|
||||
import globals as g
|
||||
import cage_func as func
|
||||
# from pyps2000b import PS2000B
|
||||
from tkinter import *
|
||||
from Arduino import Arduino
|
||||
|
||||
import cage_func as func
|
||||
import User_Interface as ui
|
||||
|
||||
# User Inputs/Configuration----------------------------------
|
||||
# Desired output:
|
||||
mag_vec1 = np.array([10, 10, 5])*1e-6
|
||||
@@ -22,15 +24,8 @@ g.Z_PORT = "COM2"
|
||||
# Code starts here------------------------------------------
|
||||
g.MAX_AMPS = np.sqrt(g.MAX_WATTS / g.RESISTANCES) # calculate maximum currents in each axis
|
||||
|
||||
print("Connecting to PSUs...")
|
||||
func.set_devices() # initiate communication, set handles
|
||||
print("Connecting to Arduino...")
|
||||
g.ARDUINO = Arduino() # search for connected arduino and set handle
|
||||
print("Arduino found, configuring pins.")
|
||||
func.setup_arduino()
|
||||
print("Activating PSU outputs...")
|
||||
func.activate_all() # activate remote control and outputs on PSUs
|
||||
mainWindow = Tk()
|
||||
MainFrame = ui.EmptyFrame(mainWindow)
|
||||
Menu = ui.TopMenu(mainWindow)
|
||||
|
||||
func.set_field_simple(mag_vec1)
|
||||
|
||||
func.deactivate_all()
|
||||
mainWindow.mainloop()
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
import numpy as np
|
||||
import globals as g
|
||||
import cage_func as func
|
||||
# from pyps2000b import PS2000B
|
||||
from Arduino import Arduino
|
||||
|
||||
# User Inputs/Configuration----------------------------------
|
||||
# Desired output:
|
||||
mag_vec1 = np.array([10, 10, 5])*1e-6
|
||||
|
||||
# Constants:
|
||||
g.COIL_CONST = np.array([38.6, 38.45, 37.9]) * 1e-9 # Coil constants [x,y,z] in T/A
|
||||
g.AMBIENT_FIELD = np.array([80]) * 1e-6 # ambient magnetic field in measurement area, to be cancelled out
|
||||
g.RESISTANCES = np.array([3.9, 1, 1]) # resistance of [x,y,z] circuits
|
||||
g.MAX_WATTS = np.array([8, 0, 0]) # max. allowed power for [x,y,z] circuits
|
||||
g.MAX_VOLTS = 16 # max. allowed voltage, limited to 16V by used diodes!
|
||||
|
||||
# COM-Ports for power supply units:
|
||||
g.XY_PORT = "COM1" # placeholders
|
||||
g.Z_PORT = "COM2"
|
||||
|
||||
# Code starts here------------------------------------------
|
||||
g.MAX_AMPS = np.sqrt(g.MAX_WATTS / g.RESISTANCES) # calculate maximum currents in each axis
|
||||
|
||||
print("Connecting to PSUs...")
|
||||
func.set_devices() # initiate communication, set handles
|
||||
print("Connecting to Arduino...")
|
||||
g.ARDUINO = Arduino() # search for connected arduino and set handle
|
||||
print("Arduino found, configuring pins.")
|
||||
func.setup_arduino()
|
||||
print("Activating PSU outputs...")
|
||||
func.activate_all() # activate remote control and outputs on PSUs
|
||||
|
||||
func.set_field_simple(mag_vec1)
|
||||
|
||||
func.deactivate_all()
|
||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -1,4 +1,4 @@
|
||||
numpy==1.19.3 # bug in numpy 1.19.4, 1.19.3 used as workaround
|
||||
pyserial~=3.5
|
||||
future~=0.18.2
|
||||
pandas~=1.1.5
|
||||
pandas
|
||||
Reference in new issue
Block a user