Plz check this code

#include “robot-config.h”

int main() {

using namespace vex;

vex::brain Brain;
vex::motor Backleftmotor (vex::PORT1, vex::gearSetting::ratio18_1, true);
vex::motor Backrightmotor (vex::PORT2, vex::gearSetting::ratio18_1, true);

while(true){
    Backleftmotor.spin(vex::directionType::fwd, Controller1.Axis3.value(), vex::velocityUnits::pct); //(Axis3+Axis4)/2
    Backrightmotor.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);//(Axis1+Axis2)/2
    
    vex::task::sleep(20); 
}

vex::motor Arm1 (vex::PORT6, vex::gearSetting::ratio18_1, true);
vex::motor Arm2 (vex::PORT7, vex::gearSetting::ratio18_1, true);

while(true){
    Arm1.spin(vex::directionType::fwd, Controller1.ButtonX.value(), vex::velocityUnits::pct); //(Axis3+Axis4)/2
    Arm2.spin(vex::directionType::fwd, Controller1.ButtonB.value(), vex::velocityUnits::pct); //(ButtonB)/2

What do you want to check on it?

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);
    }
}


@nenik has already fixed your ordering, two while loops, and curly braces. Here are two other comments:

Normally you would put

using namespace vex;
vex::brain Brain;
vex::motor Backleftmotor (vex::PORT1, vex::gearSetting::ratio18_1, true);
vex::motor Backrightmotor (vex::PORT2, vex::gearSetting::ratio18_1, true);

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?