micropython吧 关注:206贴子:114
  • 1回复贴,共1

stm32F4 + micropython 通过 pwm 驱动 360 舵机

只看楼主收藏回复

from pyb import Pin, Timer
led1 = Pin('A6', Pin.OUT_PP)
# led2 = Pin('A7', Pin.OUT_PP)
led1.value(0)
# led2.value(0)
# 频率为 50Hz 周期 20ms
tim = Timer(1, freq=50)
ch = tim.channel(1, Timer.PWM, pin=Pin.cpu.A8)
# 1200ms 1.2/20 0.060 正
# 1300ms 1.3/20 0.065 正
# 1400ms 1.4/20 0.070 停
# 1500ms 1.5/20 0.075 停
# 1600ms 1.6/20 0.080 反
# 1700ms 1.7/20 0.085 反
ch.pulse_width_percent(6.5)


IP属地:重庆1楼2021-06-15 15:19回复
    实际测试 pwm 驱动 MG 966R 360° 舵机结果于资料上的不一样,是跳线接触不良的影响吗?


    IP属地:重庆2楼2021-06-15 15:25
    回复