logo

系统报错大师指点怎么处理?

2019-04-09 17:26
R
ldgw
ef9fb3df-3c9f-4b0b-8bd4-b0a55a2c6b0d.jpg
c5e5a56a-adc4-43b8-8cb3-3fa4349cf2ca.jpg
cb4fd81a-6531-40e9-afdc-2aeff8eb19d7.jpg

inverse_left=False #change it to True to inverse left wheel

inverse_right=False #change it to True to inverse right wheel

ain1 = Pin('P0', Pin.OUT_PP)

ain2 = Pin('P1', Pin.OUT_PP)

bin1 = Pin('P2', Pin.OUT_PP)

bin2 = Pin('P3', Pin.OUT_PP)

ain1.low()

ain2.low()

bin1.low()

bin2.low()

pwma = Pin('P7')

pwmb = Pin('P8')

tim = Timer(4, freq=1000)

ch1 = tim.channel(1, Timer.PWM, pin=pwma)

ch2 = tim.channel(2, Timer.PWM, pin=pwmb)

ch1.pulse_width_percent(0)

ch2.pulse_width_percent(0)

def run(left_speed, right_speed):

if inverse_left==True:

left_speed=(-left_speed)

if inverse_right==True:

right_speed=(-right_speed)

if left_speed < 0:

ain1.low()

ain2.high()

else:

ain1.high()

ain2.low()

ch1.pulse_width_percent(abs(left_speed))

:smiling_face_with_halo:

import car

while True:
    car.run(100,100)
请在这里粘贴代码
2019-04-09 21:12
I
网红小智智 星瞳科技

https://singtown.com/learn/49239/

按照视频操作。