Halp I dont understand what any of this is. I just got vexcode today because I figured it was time a stopped using blockly for everything
Do u mean what the errors mean or what the code does?
What the errors mean
I recommend learning the basics of C++ first.
learncpp.com has some good, freely available tutorials for this purpose. There are also other sites with good materials, or you can look for a book or video series if you prefer.
Ooh thanks!
20 chars
You can’t run functions from type declarations. declare your motors like this:
vex::motor motorName = (vex::PORT1, vex::gearSetting::ratio18_1, false);
First parameter is the port, second is the gear ratio, (referring to the cartridge in the motor), and third is whether or not it’s reversed. Declare your controller like this
vex::controller controllerName;
after this, you’ve created the motor and controller objects, you can call their methods.
if(controllerName.Axis3.value() > 5){
motorName.setVelocity(controllerName.Axis3.value() / 127 * 100, pct);
}
You can change percent to RPM if you want, but be cognizant of the cartridge in the motor.
Also, you’ll have a much easier time getting help on the forum for errors if you copy/paste the entire error. It’s hard to read from the picture, and not all of it is in view.
In general, recipe for an easy-to-answer question is:
- what you’re trying to do
- what you tried
- how it didn’t work
That is not correct syntax. Either of these is a valid way to define a motor:
vex::motor motorName = {vex::PORT1, vex::gearSetting::ratio18_1, false};
vex::motor motorName{vex::PORT1, vex::gearSetting::ratio18_1, false};
vex::motor motorName(vex::PORT1, vex::gearSetting::ratio18_1, false);
Yeah I think I need to learn c++, considering how I wasn’t trying to define a motor lol
I believe we wrote the same thing, just entered it in different ways.
If your motors and controller are already defined, then use their name rather than vex::motor and vex::controller when trying to call their methods.
I’d suggest looking through the sample programs to see how VCS/VEXCode programs generally look, in addition to learning C++.
Is there a complete list of all the code in V5 Text somewhere? I found a page that has them broken down by the product. It’d be nice to have it handy. I am too lazy right now to make one.
That’s for VCS. Is it the same for VEXCode V5 Text?
VEXcode uses the same VEX C++ API that was available in VEX Coding Studio and is documented on that website.
K, thx. Appreciate the help.
Still, I’d like a single sheet with all the codes, not drop downs, etc. I’d like to just glance once and not have to dig around.
If you click the question mark in the top right corner of VEXcode there is documentation similar to VEX coding studio or that website. It also has search feature.
Thx. Nice to have it available within the program. Still, a lot of dropdown menus, etc. I’m gonna have to type it out…me lazy. But guess I’ll have to do it.
All the h files are located at
C:\Program Files (x86)\VEX Robotics\VEXcode V5 Text\sdk\vexv5\include
hope that helps…