My robotics team is having lots of trouble controlling the speed of our flywheel. Setting the velocity of the motor does nothing, it still speeds up to max power.
Code:
while (1){
FrontL.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
BackL.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
FrontR.spin(vex::directionType::rev, Controller1.Axis2.value(), vex::velocityUnits::pct);
BackR.spin(vex::directionType::rev, Controller1.Axis2.value(), vex::velocityUnits::pct);
if(Controller1.ButtonL1.pressing()) {
Intake.spin(directionType::fwd,1000,velocityUnits::rpm);
}
if(Controller1.ButtonL2.pressing()) {
Intake.spin(directionType::fwd,-1000,velocityUnits::rpm);
}
else {
Intake.stop(brakeType::brake);
}
if(Controller1.ButtonR1.pressing()) {
FlywheelDown.spin(directionType::fwd,-200,velocityUnits::rpm);
FlywheelUp.spin(directionType::fwd,200,velocityUnits::rpm);
}
else {
FlywheelDown.stop(brakeType::coast);
FlywheelUp.stop(brakeType::coast);
}
//vex::task::sleep(20); //Sleep the task for a short amount of time to prevent wasted resources.
}
}