Would it compile? No! (your curly braces are badly unbalanced).
Would it work? Well, if restructured properly, the API calls for the chassis control look reasonable, but the arm control would only run at about 1% of the speed and only up for that matter…
Perhaps you mean something like:
int main() {
vex::motor Backleftmotor (vex::PORT1, vex::gearSetting::ratio18_1, true);
vex::motor Backrightmotor (vex::PORT2, vex::gearSetting::ratio18_1, true);
vex::motor Arm1 (vex::PORT6, vex::gearSetting::ratio18_1, true);
vex::motor Arm2 (vex::PORT7, vex::gearSetting::ratio18_1, true);
while(true){
// or maybe using Controller1.Axis3.position(pct); to have the same range (-100 .. 100%)
Backleftmotor.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct);
Backrightmotor.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);
if (Controller1.ButtonX.value()) {
Arm1.spin(vex::directionType::fwd, 100, vex::velocityUnits::pct);
Arm2.spin(vex::directionType::fwd, 100, vex::velocityUnits::pct); //(ButtonB)/2
} else if (Controller1.ButtonB.value()) {
Arm1.spin(vex::directionType::fwd, -100, vex::velocityUnits::pct);
Arm2.spin(vex::directionType::fwd, -100, vex::velocityUnits::pct); //(ButtonB)/2
} else {
Arm1.stop(brakeType::hold);
Arm2.stop(brakeType::hold);
}
vex::task::sleep(20);
}
}
inside robot-config.h instead. This may not matter here, but sometimes it definitely matters. For example, you won’t get to the utility for the vision sensor through here, but through robot-config.h instead.
Also, the whole point of
using namespace vex;
is that you can avoid typing “vex::” everywhere. It’s slightly risky, but probably inconsequentially. But if you aren’t even going to use it (you’ve typed “vex::” everywhere), then why even include it?