Hi all, I’ve coded before, but never in VEX. I want a motor to move when I depress a button on my controller. The specific part of my program that does this is:
if controller_1.buttonr2():
sucker_1.spin(FORWARD)
pass
When the program is ran, I get the error:
“Traceback (most recent call last): Python exception …
File “userpy”, line 90, in
AttributeError: no such attribute”
Do I need to import some sort of controller library for this function to work correctly?
Any help is appreciated, thank you in advance.
I would’nt suggest using python for coding your robot. If you able to use C++ its much easier to learn in my opinion. You should not have to install anything.
if you want to use c++ to code, you need to download vexcode v5 pro.
vexcode v5 only has blocks and python.
rant
Chaging the names of these programs was a bad move, it causes so much confusion about which program to download. vexcode v5 and vexcode v5 pro describe nothing about what the program is for, while the old names, vexcode v5 blocks (you could add “& python” to the end to be even more descriptive) and vexcode v5 text describe the programs and their uses perfectly. even clicking “learn more about this version” on the website tells you very little about what each one does. Just my 2 cents.
Whitespace and case both matter in Python, the main part of your program should be:
# Begin project code
while True:
if controller_1.buttonR2.pressing():
sucker_1.spin(FORWARD)
AttributeError: no such attribute is the kind of error you’d expect to get when you refer to an attribute that doesn’t exist, such as buttonr2 (which is not the same as buttonR2).
Once C++ is implemented in VEXcode V5, the old naming convention would make no sense because you’d have “VEXcode V5 Blocks, Python and C++” as one piece of software, and “VEXcode V5 C++” as the other.
Whilst you could debate what the names should be, VEXcode V5 and VEXcode V5 Pro do suggest that one version is for more experienced users.
if they plan on implementing c++ into vexcode v5, why even have 2 different programs at that point? idk, I’ve just seen so much confusion caused by people not knowing which program to download.
My guess is because C++ will never be integrated into VEXcode in the same way that it is using the Monaco editor in Pro where you have a lot more control over all sorts.
It’ll be beginner C++ and higher (Pro if you will) C++