What is the basic way to make a function in VCS. Do you just program the code in the same manner as autonomous?
Why are you not using vexCode? But I think you do it like
Void whatYouWantToNameIt(input you want){
Commands you want to do;
}
When I downloaded vexCode, the program would not recognize that the robot was plugged in. I called Vex’s tech support twice, and got the robot to be recognized once. After that I said, “I’m a senior, and don’t care enough to learn another new, uncooperative program’s syntax.”
I think the functions will work the same otherwis.
I’ll check it out (hopefully tonight) I’m a bit busy so it could be next week when I get around to it.
VEXCode is literally a VCS copy but better.
Theres two types of functions, a void and a return function:
void functionName(int val1, int val2){
//code
}
Called with
functionName(1, 12);
or
void functionName(){
//code
}
Called with
functionName();
Return functions:
int functionName(double val){
//code
return (int)val;
}
Called with
int billWiTheScienceFi = functionName(13.1);
VCS is dead and has been pretty much since its release, despite Vex’s statements to the contrary. I highly suggest switching to a real programming environment such as VexCode, Robot Mesh Studio, or PROS.
What does the billaWitheScienceFi mean in the second function.
Nothing. Variable names are arbitrary. It could be foo
or bar
and make no difference.
Its just there to represent that you can give the variable any name yet you can still utilize its value. Like
int bear = 12;
bool colliflour = true;
double beans = 10.55
I just thought functionName was supposed to stand in for the actual name, not the random term
void autonomous (void)
FrontLeft.spin(fwd);
task::sleep::vex(30);
moves front left forward for 30 ms
So something like this:
int functionName(100){
motorLeft.rotateTo(130,rotationUnits::deg,50,velocityUnits::pct, waitForCompletion = true);
return (int)val;
}
called with
int tilt = functionName(10);
If youre just doing a regular non-return function, just do a void function:
void functionName(int amt){
motorLeft.rotateTo(amt,rotationUnits::deg,50,velocityUnits::pct, waitForCompletion = true);
}
called with
functionName(10);
Thanks I think this is what I’m looking for