Hello, I am fairly beginner level to C++ and am having trouble with my dual motor flywheel for Vex V5 Spin up. I am having trouble turning on both motors (in a motor group). It uses voltage, and I have tried many different types of lines like spinFor, or even spin(). I have a competition coming up this weekend and I really need some help. Here is my code:
MAIN.CPP
void pre_auton(void) {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
// All activities that occur before the competition starts
// Example: clearing encoders, setting servo positions, ...
}
void autonomous(void) {
// ..........................................................................
// Insert autonomous user code here.
// ..........................................................................
Drivetrain.driveFor(forward,2, inches);
Intake_Roller.spinFor(forward,.25,turns);
Drivetrain.driveFor(reverse,5,inches);
Drivetrain.turnFor(left,75,degrees);
Flywheel.spinFor(forward, 75, turns);
}
int main() {
// Set up callbacks for autonomous and driver control periods.
Competition.autonomous(autonomous);
Competition.drivercontrol(usercontrol);
Indexer.setVelocity(50, percent);
Intake_Roller.setVelocity(100, percent);
// Run the pre-autonomous function.
pre_auton();
// Prevent main from exiting with an infinite loop.
while (true) {
wait(100, msec);
}
}
ROBOT CONFIG
//F L Y W H E E L C O D E
if (Controller1.ButtonL1.pressing()) {
Flywheel.spin(forward, 10, voltageUnits::volt);
} else if (Controller1.ButtonL2.pressing()) {
Flywheel.spin(reverse, -10, voltageUnits::volt);
} else {
Flywheel.stop();
// set the toggle so that we don't constantly tell the motor to stop when the buttons are released
Controller1LeftShoulderControlMotorsStopped = true;
}
edit: mods fixed the code tags for you, use three back ticks