How can you create custom commands

I heard that you can create custom commands somehow. So instead of typing a bunch of jargon over and over again, I could program it to recognize move forward as the command instead. Can someone tell me how to do this? It would be quite helpful. I am using c++ vex.

1 Like

You could create a function for a command that you want to run multiple times.
Example, a function to drive the robot forward by a certain distance:

void driveForward(int numInches) {

double numDegrees = //do math for how far to spin the wheels to get the correct distance
leftMotor.startSpinFor(fwd, numDegrees, deg);
//other drive motors


Then in your main, you would call this function to tell the bot to drive forward.


Nice, I think I understand that and I will try it out once I get my hands on a computer again. Thank you for the quick reply!

1 Like

Lots more info on functions in C++ here.


Thank you, I will check it out!