例程讲解23-Motor-Shield->motor-shield-pwm 电机驱动板输出PWM
import pyb
pinADir0 = pyb.Pin('P3', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
pinADir1 = pyb.Pin('P2', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
pinBDir0 = pyb.Pin('P1', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
pinBDir1 = pyb.Pin('P0', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
pinADir0.value(0)
pinADir1.value(1)
pinBDir0.value(0)
pinBDir1.value(1)
tim = pyb.Timer(4, freq=1000)
chA = tim.channel(1, pyb.Timer.PWM, pin=pyb.Pin("P7"))
chB = tim.channel(2, pyb.Timer.PWM, pin=pyb.Pin("P8"))
while (True):
for i in range(100):
pyb.delay(100)
chA.pulse_width_percent(i)
chB.pulse_width_percent(99-i)
for i in range(100):
pyb.delay(100)
chA.pulse_width_percent(99-i)
chB.pulse_width_percent(i)
星瞳科技OpenMV官方中文文档函数讲解:
星瞳科技OpenMV官方中文文档函数讲解:
星瞳科技OpenMV官方中文文档函数讲解:
星瞳科技OpenMV官方中文文档函数讲解: