How to combine all drive motors to one function

Ok our team wants to make a auton but are unable to because we can’t make one word/function to control the drivetrain.

You can use motor groups if you want to run multiple motors at once. In VexCode Pro, the motor groups would look like this (let me know if you are using pros or anything else):

//Define all motors
//Create the motor group, replace everything in parenthesis with names of motors, you can add up to 16
vex::motor_group driveMotorGroup(LeftMotor1, LeftMotor2, RightMotor1, RightMotor2);
//You can also separate this into two different motor_groups, one for leftDrive and one for rightDrive

//Run motor group
driveMotorGroup.spinFor(forward, 1, turns);

This will allow your motors to move in sync for autonomous, and you can modify how much the motors spin or use a different function. The motor group will work just like one motor, you can use all the same functions to run it, so this should allow you to run all your motors in one word/line.


The Drivetrain object is designed to do exactly that.

Could you provide more detail on what you currently have for code?

I fixed it. I had to put
motor_group Drivetrain = motor_group(L1,L2)