Reverse motor on a drive train

This is related to code and building I guess, but can I reverse some motors in a drive train, cough cough, my back left and right?

4 motor drive here, moved to drive today coz we got clapped last comp yesterday without it

maybe like [motor].setReversed? I really hope vex code will have an official documentation for simplicity

Typically you would reverse the motors when you declare (initialize) them in your code. This way when you tell the motors to spin forward then all will spin the correct direction.

//Declare motors - use true in second value to always reverse direction.
vex::motor LeftMotor   = vex::motor( vex::PORT1, false );
vex::motor RightMotor  = vex::motor( vex::PORT10, true );

int auton1() {
    //Set Overall speed
    LeftMotor.setVelocity( 50, vex::velocityUnits::pct );
    RightMotor.setVelocity( 50, vex::velocityUnits::pct );
    
    LeftMotor.spin( vex::directionType::fwd );
    RightMotor.spin( vex::directionType::fwd );
    
    vex::task::sleep( 2000 );
    
    LeftMotor.stop();
    RightMotor.stop();

    vex::task::sleep( 2000 );

    LeftMotor.spin( vex::directionType::rev );
    RightMotor.spin( vex::directionType::rev );

    vex::task::sleep( 2000 );
    
    LeftMotor.stop();
    RightMotor.stop(); 

}

int main() {
    auton1();
}
4 Likes

Do you use Vexcode, Modkit, or RobotC?

Vex code

Insert character