0

首先,我要为我糟糕的英语感到抱歉。

我正在尝试使用 ev3dev2 库和 Visual Studio Code 将 python 代码添加到我的 ev3 机器人。我的问题是,当我尝试使用“Leds”类中的函数“animate_stop”(或“animate_flash”、“reset”等)时,我收到一条错误消息,指出被调用的函数不是对象“Leds”,但是当我打开“led.py”文件(包含“Leds”类)时,我找到了我试图调用的所有函数。

我已经从 github 安装了 ev3dev2,并从其站点安装了 ev3 的官方 SD 卡映像文件。

编码:

#!/usr/bin/env pybricks-micropython

from ev3dev2.led import Leds

Leds().animate_stop

错误:

Traceback (most recent call last):
  File "/home/robot/ttt/main.py", line 5, in <module>
AttributeError: 'Leds' object has no attribute 'animate_stop'
4

1 回答 1

0

尝试这个:

#!/usr/bin/env pybricks-micropython

from ev3dev2.led import Leds

leds = Leds()
leds.all_off()
于 2020-08-06T19:08:15.113 回答