You have the motor spinning at positive speeds and spinning forward, and it spins at negative speeds in reverse in the other instance. You have a double negative.
In your code, I fixed the issue for the intake, but not the scraper. You need to take care of that. I want you to learn how to code, so If I just gave away the full answer I wouldn’t be doing that.
Code
This text will be hidden
FlywheelDown.spin(directionType::fwd,80,velocityUnits::rpm);
FlywheelUp.spin(directionType::fwd,-80,velocityUnits::rpm);
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::rev,600,velocityUnits::rpm);
}
if(Controller1.ButtonL2.pressing()) {
Intake.spin(directionType::rev,-600,velocityUnits::rpm);
}
else {
Intake.stop(brakeType::brake);
}
if(Controller1.ButtonR1.pressing()) {
FlywheelDown.spin(directionType::fwd,100,velocityUnits::rpm);
FlywheelUp.spin(directionType::fwd,-100,velocityUnits::rpm);
//-100, 100 is max, good for top flag shooting/full court
}
if(Controller1.ButtonR2.pressing()) {
FlywheelDown.spin(directionType::fwd,70,velocityUnits::rpm);
FlywheelUp.spin(directionType::fwd,-70,velocityUnits::rpm);
//-100, 100 is max, good for top flag shooting/full court
}
if(Controller1.ButtonR2.pressing()) {
}
else {
;
}
if(Controller1.ButtonA.pressing()) {
Scraper.spin(directionType::fwd,100,velocityUnits::rpm);
}
if(Controller1.ButtonB.pressing()) {
Scraper.spin(directionType::rev,100,velocityUnits::rpm);
}
else {
Scraper.stop(brakeType::brake);
}
vex::task::sleep(20);
Thanks for the reply! Our team has found it hard to switch from robot c to c++ programming. We are attempting to make the switch in order to compete with the other v5 robots at worlds.
Also, every time through the loop you set ±80 rpm even when you’re pressing a button to set them to ±100 rpm or ±70 rpm. This will cause problems. You should really have a single if-else if-else loop, using the conditions for the if and else if, and putting the default in the else.