logo

AttributeError: 'module' ojbect has no attribute 'run'

2019-03-19 01:21
1
ho6f
680e94b5-d2cc-4107-a9e6-c91588125498.png
2019-03-19 14:02
I
网红小智智 星瞳科技

如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片

2019-03-19 19:49
1
ho6f
43219b31-72aa-4811-9465-a45eb0918283.png
893245b9-2b59-4951-bdef-4fc1adc00e3e.png
a87ede6f-931e-4308-b283-75db4b643c01.png
2019-03-21 23:10
1
ho6f

等了好几天了,有大佬知道的吗

2019-03-22 10:25
I
网红小智智 星瞳科技

都和你说"请注意不要贴代码图片",别人无法复现错误,怎么帮你?

2019-04-01 13:34
1
ho6f

代码就是你们教程给的呀 没有任何改动,就是运行不了

1
ho6f
from pyb import Pin, Timer
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))

    if right_speed < 0:
        bin1.low()
        bin2.high()
    else:
        bin1.high()
        bin2.low()
    ch2.pulse_width_percent(abs(right_speed))

第二个import car

while True:
    car.run(100,100)
2019-04-01 16:48
1
ho6f

求回复回复回复呀

2019-04-01 17:49
I
网红小智智 星瞳科技

我猜你的car.py没有正确下载到OpenMV里。

2019-04-01 19:15
1
ho6f
d4272208-6b25-4ebd-8a40-6f8f650bcbbb.png
1
ho6f

这算正确吗,,,,,,

2019-04-01 20:09
I
网红小智智 星瞳科技

不知道,你要打开这个文件看看里面的内容。

1
ho6f

现在是没有上面的保存了 程序也没问题 但是就是轮子不转

1
ho6f

没有上面的问题了

I
网红小智智 星瞳科技

新的问题,单独发帖子。