Vex C++ coding help

Hi,
I’m not very good at coding, especially with V5, so I was wondering how I could code my slip gear catapult to go down using a quadratic encoder with Vex c++.

I was wondering the same thing.

I could also use a potentiometer, but I don’t know how to use that either.

You’re using V5? You can just skip the quadrature encoder if you want. Figure out how much the motor must rotate. If you are comfortable with events, do the following:

Use this:

Motor.rotateTo(double rotation, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)

Set up two functions:

void rotateToCock(void) {
     catapultMotor.rotateTo(); // Insert the appropriate values to move it down to be just about to fire.
}
void rotateToFire(void) {
     catapultMotor.rotateTo(); // Insert the appropriate values to rotate far enough to slip. You can always rotate the slip gear 360 degrees so you only have to cock it once with the prior command. Or you could make sure the prior command and this total a 360-degree turn for the slip gear.
}

Use those as needed in your autonomous. Then in user control use these commands early, before your repeat:

Controller1.ButtonDown.pressed(rotateToCock); // Replace down with your choice. If you've gone with setting rotateToFire to do 360 degrees, you might leave this out entirely, too.
Controller1.ButtonUp.pressed(rotateToFire); // Replace up with your choice.

You might also find it handy at the beginning and maybe later on to make a third function to fine tune things, each time you press some button the motor rotates just a tiny amount. You can then press that button to very slowly nudge the slip gear along in case it isn’t cocked to where you want it.