Amanda, I am now able to address each device in my code, 3 so far, I think…I’m unable to fully test because I do not have motors yet and will not be delivered until the end of the month. There are green LED blinks on each Tic when I run and test my GUI. To answer your questions I was able to address then using the ticgui and list them in terminal. Yes I did run the example code and it worked for 1 Tic only. More than one throws an error message indicating that there is more than 1 device and I need to unplug all but 1 from usb. You may notice that I used 2 lines of the example code at the beginning of my GUI code. It would not run without it. I tried commenting that out line by line and it wouldn’t go. I am enclosing my GUI code. There are some commented out sections because I started this using some DC motors and the GPIO on the Pi 4. I’m doing all of my work writing code on the Pi.
Happy Pi Day!
# Importing Libraries
from tkinter import *
import tkinter.font
import subprocess
import yaml
# from ticcmd import ticcmd
# Libraries Imported
# tkinter GUI basic settings
Gui = Tk()
Gui.title("Slat Stepper Motor Control with Pi 4")
Gui.config(background= "#0060FF")
Gui.minsize(511,400)
Font1 = tkinter.font.Font(family = 'Helvetica', size = 9, weight = 'bold')
# tkinter GUI created
def ticcmd(*args):
return subprocess.check_output(['ticcmd'] + list(args))
def MotorPos1():
ticcmd('-d',"00331613",'--position', "100")
ticcmd('-d',"00331629",'--position', "50")
ticcmd('-d',"00331609",'--position', "110")
def MotorPos2():
ticcmd('-d',"00331613",'--position', "100")
ticcmd('-d',"00331629",'--position', "50")
ticcmd('-d',"00331609",'--position', "10")
def MotorPos3():
ticcmd('-d',"00331613",'--position', "75")
ticcmd('-d',"00331629",'--position', "50")
ticcmd('-d',"00331609",'--position', "100")
def Closed():
ticcmd('-d',"00331613",'--position', "0")
ticcmd('-d',"00331629",'--position', "0")
ticcmd('-d',"00331609",'--position', "0")
#def MotorStop():
#GPIO.output(16, GPIO.LOW) # Motor a and b will stop.
#GPIO.output(18, GPIO.LOW)
#GPIO.output(19, GPIO.LOW)
#GPIO.output(24, GPIO.LOW)
#def ChangePWM(self):
#ena.ChangeDutyCycle(Scale1.get())
#enb.ChangeDutyCycle(Scale1.get())
#Scale1 = Scale(Gui, from_=0, to=100, orient = HORIZONTAL, resolution = 1, command = ChangePWM)
#Scale1.grid(row=4,column=2)
Text2 = Label(Gui,text='Set Positions Above', font = Font1, fg='#FFFFFF', bg = '#0060FF')
Text2.grid(row=2,column=2,columnspan=2)
#Text3 = Label(Gui,text='Set Move Speed', font = Font1, fg='#FFFFFF', bg = '#0060FF')
#Text3.grid(row=3,column=2,)
photo = PhotoImage (file='/home/pi/motor_slats/Slats_1resize2.png')
photo1 = PhotoImage (file='/home/pi/motor_slats/Slats_2resize2.png')
photo2 = PhotoImage (file='/home/pi/motor_slats/Slats_3resize.png')
photo3 = PhotoImage (file='/home/pi/motor_slats/Slats_closed.png')
##Button1 = Button(Gui, text='A-Clockwise', font = Font1, command = MotorClockwise, bg='bisque2', height = 0, width = 10)
#Button1.grid(row=4,column=0)
#Button2 = Button(Gui, text='All-Stop', font = Font1, command = MotorStop, bg='bisque2', height = 0, width = 10)
#Button2.grid(row=4,column=1)
#Button2 = Button(Gui, text='A-AntiClockwise', font = Font1, command = MotorAntiClockwise, bg='bisque2', height = 0, width = 10)
#Button2.grid(row=4,column=4)
Button2 = Button(Gui, command = MotorPos3, image= photo1, text = 'Position 3', compound= "center")
Button2.grid(row=0,column=3,)
Button2 = Button(Gui, command = MotorPos2, image= photo2, text = 'Position 2', compound= "center")
Button2.grid(row=0,column=2,)
Button0 = Button(Gui, command = MotorPos1, image= photo, text = 'Position 1', compound= "center")
Button0.grid(row=0,column=1,rowspan=2)
Button2 = Button(Gui, command = Closed, image= photo3, text = 'Closed', compound= "center")
Button2.grid(row=0,column=4,)
Text3 = Label(Gui,text='A Learning Project By Mike Knight', font = Font1, bg = '#0060FF', fg='#FFFFFF', padx = 25, pady = 25)
Text3.grid(row=6, column=2, columnspan=2)
#ticcmd('--exit-safe-start', '--position', str(new_target))
Gui.mainloop()