So basically I started coding my robot, (C++, VCS) and then downloaded it onto my robot. The tank control worked fine, but the buttons ( L1 and R1) when pressed, wouldn’t do anything. I was wondering why. Below is a picture of my code. Thanks for any help!
Where are all the vex:: parts? Have you locally redefined all those things that had been defined elsewhere? Most likely you haven’t, and the program doesn’t know where to find things like velocityUnits::pct. Try vex::velocityUnits::pct, for example. You have a whole bunch of those to fix.
Ah, I see now. Not being able to see into robot-config.h in Vex C++ hides “using namespace vex;”. And I would guess with the restrictions in place in Vex C++, that’s far less likely to be a problem than “using namespace” might otherwise be.
So, since “using namespace vex;” is included, ignore my first post. Those parts aren’t a problem. I’m not seeing what’s wrong with the code, though. @7517j , have you tried it with just the code you sent? Was the tank control part removed to post that part? There could be something between the two, like the while loop ending after tank control and before the button presses. Have you double-checked the port for the motor to make sure it matches where the code things it is?
I personally suspect the motors may be not be in the right ports or something like that. That’s why I asked about the code running as is v. with the other parts mentioned and asked if the motor port had been double checked.
Since “using namespace vex” is there, Vex C++ will use that namespace as a default when looking for things. Generally you’ll be OK doing this. You can run into problems. For example, let’s say you say “using namespace vex” and “using namespace myMotorCommands” and both of them have an identical command. Now you’ll run into trouble. But if you’d written them as vex::(whatever) v. myMotorCommands::(whatever), then that (whatever) could be identical and there wouldn’t be a problem. So, no, you won’t need vex:: on everything if you’re using Vex C++. But you will with Vex C++ Pro unless you put “using namespace vex” in there yourself.