用tkinker的进度条输出pwm控制无刷电机
def print_select1(v):
l12.config(text='pwm12 out pecent is ' str((float(v)/20 5)))
pwm12.ChangeDutyCycle(float(v)/20 5)
l18.config(text='pwm18 out pecent is ' str((float(v)/20 5)))
pwm18.ChangeDutyCycle(float(v)/20 5)
def print_select2(v):
l12.config(text='pwm12 out pecent is ' str((float(v)/20 5)))
pwm12.ChangeDutyCycle(float(v)/20 5)
l18.config(text='pwm18 out pecent is ' str((float(v)/20 5)))
pwm18.ChangeDutyCycle(float(v)/20 5)
def print_select3(v):
l13.config(text='pwm13 out pecent is ' str((float(v)/20 5)))
pwm13.ChangeDutyCycle(float(v)/20 5)
l19.config(text='pwm19 out pecent is ' str((float(v)/20 5)))
pwm19.ChangeDutyCycle(float(v)/20 5)
s11=tk.Scale(window,label='Fordward',from_=0,to=100,
orient=tk.VERTICAL,length=200,command=print_select1)
s11.pack()
s12=tk.Scale(window,label='Turn',from_=-50,to=50,
orient=tk.HORIZONTAL,length=200,command=print_select2)
s12.pack()
s13=tk.Scale(window,label='Vertical',from_=-50,to=50,
orient=tk.VERTICAL,length=200,command=print_select3)
s13.place(x=500,y=40)
评论