没用点击拓展板,直接连的主板,怎么能控制速度
import pyb
These pins will be the ones we control to drive the
H-Bridge sides as we like.
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)
#tim = pyb.Timer(4, freq=1000)
#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(0)#左侧正滑
pinC.value(0)#右侧倒滑
pinD.value(0)#右侧正滑