找传奇、传世资源到传世资源站!

进度条控制无刷电机(SliderContral.py)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

用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)

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复