ev3dev / ev3dev-lang-python

Pure python bindings for ev3dev
MIT License
425 stars 144 forks source link

Object Leds has no attribute animate_stop (ev3dev2 library) #726

Closed giacomoocasarin closed 4 years ago

giacomoocasarin commented 4 years ago

First of all I want to sorry for my bad English.

I'm trying to use the ev3dev2 library and Visual Studio Code to add python code to my ev3 robot. My problem is that when I try to use the function 'animate_stop' (or 'animate_flash', 'reset', and some others) from the class 'Leds' I get an error saying that the called function isn't an attribute of the object 'Leds' but when I opened the 'led.py' file (which contains the 'Leds' class) I found all the functions that I tried to call.

I have installed ev3dev2 from github and the official SD card image file for the ev3 from its site.

The code:

#!/usr/bin/env pybricks-micropython

from ev3dev2.led import Leds

Leds().animate_stop

The error:

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

@Jacky3103 you are using pybricks-micropython which is not the same as ev3dev-lang-python.

dlech commented 4 years ago

In other words, the first line should be

#!/usr/bin/env micropython
WasabiFan commented 4 years ago

@Jacky3103 Were you able to solve your issue using the above change?