I’ve Complained a program that theoretical run and there is no mistakes in my code for my tower-takeover bot but when i attempt to run the program my robot has no response, HELP ME PLS!!!
We need more info. What code are you using? Did you check everything is in the right port?
everything is in the right port and i’m using C++ but when i download it to my robot and click run my robot does nothing, like my controller has no response to it
this is my code
int main() {
LeftMotor.spin(directionType::fwd, Controller1.Axis3.value()/3, velocityUnits::pct);
RightMotor.spin(directionType::fwd, Controller1.Axis2.value()/3, velocityUnits::pct);
if (Controller1.ButtonUp.pressing()==1){
LeftArm.spin(directionType::fwd,50,velocityUnits::pct);
RightArm.spin(directionType::fwd,50,velocityUnits::pct);
task::sleep(3000);
LeftArm.stop(brakeType::coast);
RightArm.stop(brakeType::coast);
}
if(Controller1.ButtonDown.pressing()==1){
LeftArm.spin(directionType::rev,50,velocityUnits::pct);
RightArm.spin(directionType::rev,50,velocityUnits::pct);
task::sleep(3000);
}
if(Controller1.ButtonR1.pressing()==1){
RampMotor.spin(directionType::fwd,50,velocityUnits::pct);
RampMotor.stop(brakeType::coast);
}
if(Controller1.ButtonL1.pressing()==1){
RampMotor.spin(directionType::rev,50,velocityUnits::pct);
}
if(Controller1.ButtonR2.pressing()==1){
LeftScoop.spin(directionType::fwd,50,velocityUnits::pct);
RightScoop.spin(directionType::fwd,50,velocityUnits::pct);
}
if(Controller1.ButtonL2.pressing()==1){
LeftScoop.spin(directionType::rev,50,velocityUnits::pct);
RightScoop.spin(directionType::rev,50,velocityUnits::pct);
}
}
I believe you are missing a while loop around the entire code to keep it running over and over.
Without any repeating loop the program only checks for controller inputs once.
2 Likes
I think @shredbeard is right about the while loop. You’ll just need a while(1) around your code.
I can’t see your declarations but assuming those are correct your code should be good.
Also, it’s not necessarily a problem but your ‘.pressing()==1’ is redundant since .pressing() returns either true or false.
2 Likes