Issues With Motor Groups

I am currently having an issue using motor groups. Using the competition template I have the motor groups initialized in the robot-config.cpp file. Then within the vexcodeInti function I am defining the motors that will be used in the motor group and then re defining the motor group.

An Example:

motor_group leftMotors;

void vexcodeIniti(void) {
motor leftWheelMotorA = motor(PORT1, ratio18_1, true);
motor leftWheelMotorB = motor(PORT2, ratio18_1, true);

leftMotors =motor_group(leftWheelMotorA, leftWheelMotorB);
}

Later in the code I set the leftMotors velocity and start spinning. the code compiles fine but the physical motors do not run when I run the spin function on the motor group. Any help on how to fix this would be greatly appreciated.

should be

motor_group leftMotors = motor_group(leftWheelMotorA, leftWheelMotorB);

In addition, take the

motor leftWheelMotorA = motor(PORT1, ratio18_1, true);
motor leftWheelMotorB = motor(PORT2, ratio18_1, true);

should not be inside the

void vexcodeInit (void) {
//nothing to initialize
}

section on robot-config.cpp.
Hope that helps!

This post on VEXcode V5 Text Version 1.0.1 Release should help as well:

1 Like

That solution does work. Thanks man.