Help! My coding won't work

int armSpeedPCT = 50;
int clawSpeedPCT = 50;

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

    if(Controller1.ButtonA.pressing()) {
        Claw.spin(directionType::fwd, clawSpeedPCT, velocityUnits::pct);
    }
    else if(Controller1.ButtonY.pressing()) {
        Claw.spin(directionType::rev, clawSpeedPCT, velocityUnits::pct);
    }
    else {
        Claw.stop(brakeType::brake);        
    }

    task::sleep(20);
}

}

int main() {

int armSpeedPCT = 50;
int clawSpeedPCT = 50;

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

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

    task::sleep(20);
}

Why won’t this work? The arms and claws won’t move. Is it a logical error?

It kind of looks like you pasted your code twice, is that while loop above int main supposed to be there?

I thought so, but I might’ve been wrong. Thanks for the help. I will check the coding again.

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