Example explanation 23-Motor-Shield->motor-shield-power-driver DC motor driver board

Video Tutorial 26 - Motor Extension Version Controlling DC Motor: https://singtown.com/learn/50231/

# 电机扩展板驱动直流电机示例
#
# 此示例显示如何使用电机扩展板来控制高电流开关等。 
# 由于电机扩展板提供两个H桥驱动器,因此它能够提供4个高电流推挽输出。 
# 每个输出分别可以达到1A。
import pyb

# 这些引脚将是我们控制的驱动H桥侧的引脚。
pinA = pyb.Pin('P3', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
pinB = pyb.Pin('P2', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
pinC = pyb.Pin('P1', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)
pinD = pyb.Pin('P0', pyb.Pin.OUT_PP, pyb.Pin.PULL_NONE)

# 创建一个以1KHz运行的定时器对象,它将为我们的OpenMV Cam上的PWM输出供电。 
# 只需要创建一次。
tim = pyb.Timer(4, freq=1000)

# 如果你想改变驱动动力,这些PWM通道将在上面的H桥驱动器上设置PWM百分比。 
pinABPower = tim.channel(1, pyb.Timer.PWM, pin=pyb.Pin("P7"), pulse_width_percent=100)
pinCDPower = tim.channel(2, pyb.Timer.PWM, pin=pyb.Pin("P8"), pulse_width_percent=100)

while (True):

    pyb.delay(1000)
    pinA.value(0)
    pinB.value(1)
    pinC.value(0)
    pinD.value(1)

    pyb.delay(1000)
    pinA.value(1)
    pinB.value(0)
    pinC.value(1)
    pinD.value(0)

Singtown Technology OpenMV official Chinese document function explanation:

Singtown Technology OpenMV official Chinese document function explanation:

Singtown Technology OpenMV official Chinese document function explanation:

Singtown Technology OpenMV official Chinese document function explanation:

results matching ""

    No results matching ""