Our arms and claws won't work

void usercontrol( void ) {

// User control code here, inside the loop

while(true) {
    LeftFront.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct); //(Axis3+Axis4)/2
    RightFront.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);//(Axis3-Axis4)/2
    
    vex::task::sleep(20); 
}






//Use these variables to set the speed of the arm and claw.
int armSpeedPCT = 100;
int clawSpeedPCT = 100;

while(true) {
    if(Controller1.ButtonL1.pressing()) {
        Arm.spin(directionType::fwd, armSpeedPCT, velocityUnits::pct);
    }
    else if(Controller1.ButtonL2.pressing()) {
        Arm.spin(directionType::rev, armSpeedPCT, velocityUnits::pct);
    }
    else {
        Arm.stop(brakeType::brake);
    }

    if(Controller1.ButtonR1.pressing()) {
        Claw.spin(directionType::fwd, clawSpeedPCT, velocityUnits::pct);
    }
    else if(Controller1.ButtonR2.pressing()) {
        Claw.spin(directionType::rev, clawSpeedPCT, velocityUnits::pct);
    }
    else {
        Claw.stop(brakeType::brake);        
    }
    
    if(Controller1.ButtonL1.pressing()) {
        Arm1.spin(directionType::fwd, armSpeedPCT, velocityUnits::pct);
    }
    else if(Controller1.ButtonL2.pressing()) {
        Arm1.spin(directionType::rev, armSpeedPCT, velocityUnits::pct);
    }
    else {
        Arm1.stop(brakeType::brake);
    }

    if(Controller1.ButtonR1.pressing()) {
        Claw1.spin(directionType::fwd, clawSpeedPCT, velocityUnits::pct);
    }
    else if(Controller1.ButtonR2.pressing()) {
        Claw1.spin(directionType::rev, clawSpeedPCT, velocityUnits::pct);
    }
    else {
        Claw1.stop(brakeType::brake);        
    }


    task::sleep(20);
}

}
Our arm and claw wouldn’t move

update

void usercontrol( void ) {

// User control code here, inside the loop

while(true) {
    LeftFront.spin(vex::directionType::rev, Controller1.Axis3.value(), vex::velocityUnits::pct); //(Axis3+Axis4)/2
    RightFront.spin(vex::directionType::fwd, Controller1.Axis2.value(), vex::velocityUnits::pct);//(Axis3-Axis4)/2
    
    vex::task::sleep(20); 
}

{




//Use these variables to set the speed of the arm and claw.
int armSpeedPCT = 100;
int clawSpeedPCT = 100;

while(true) {
    if(Controller1.ButtonL1.pressing()) {
        Arm.spin(directionType::fwd, armSpeedPCT, velocityUnits::pct);
    }
    else if(Controller1.ButtonL2.pressing()) {
        Arm.spin(directionType::rev, armSpeedPCT, velocityUnits::pct);
    }
    else {
        Arm.stop(brakeType::brake);
    }

    if(Controller1.ButtonR1.pressing()) {
        Claw.spin(directionType::fwd, clawSpeedPCT, velocityUnits::pct);
    }
    else if(Controller1.ButtonR2.pressing()) {
        Claw.spin(directionType::rev, clawSpeedPCT, velocityUnits::pct);
    }
    else {
        Claw.stop(brakeType::brake);        
    }
    
    if(Controller1.ButtonL1.pressing()) {
        Arm1.spin(directionType::fwd, armSpeedPCT, velocityUnits::pct);
    }
    else if(Controller1.ButtonL2.pressing()) {
        Arm1.spin(directionType::rev, armSpeedPCT, velocityUnits::pct);
    }
    else {
        Arm1.stop(brakeType::brake);
    }

    if(Controller1.ButtonR1.pressing()) {
        Claw1.spin(directionType::fwd, clawSpeedPCT, velocityUnits::pct);
    }
    else if(Controller1.ButtonR2.pressing()) {
        Claw1.spin(directionType::rev, clawSpeedPCT, velocityUnits::pct);
    }
    else {
        Claw1.stop(brakeType::brake);        
    }


    task::sleep(20);
}

}

}

You have two infinite loops but the second one (with all your arm/claw code) never executes since the program stays in the first while loop. Put all you claw/arm code inside the same loop as the movement control and bin the second while loop.

3 Likes

Yep I would move it all into one

Please don’t keep commenting unhelpful stuff eg. Repeating what other people say or not knowing

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.