logo

在“追小球的云台”例程中,可以将底部舵机换为360度的吗?

2021-05-30 22:47
A
_5zn3

已将底部舵机换为360度,已尝试写控制舵机旋转角度的代码(如下),可是不会将其与例程结合了,求大神解答

import time
from pyb import Pin,Timer

tim = Timer(4, freq=50) # 生成50HZ方波,使用TIM4
ch1 = tim.channel(1, Timer.PWM, pin=Pin("P7"), pulse_width_percent=7.5)#占空比为7.5时停止

def tick(tim1):
    ch1.pulse_width_percent(7.5)#舵机停下

ch1.pulse_width_percent(6.5) #通过占空比调整舵机速度
tim1=Timer(2,freq=71/180) #让舵机转180度所需时间为180/71秒
tim1.callback(tick)

while (True):
    time.sleep_ms(1000)
A
_5zn3

顺便请问一下 在原例程中 pan_error 和pan_output是啥呀