Please help me with my coding

vex::task::sleep(2000);
Brain.Screen.print(“User Program has Started.”);

LeftFront.setVelocity(50, vex::velocityUnits::pct);
RightFront.setVelocity(50, vex::velocityUnits::pct);

LeftFront.spin(vex::directionType::fwd);
RightFront.spin(vex::directionType::fwd);

vex::task::sleep(3000);

LeftFront.stop();
RightFront.stop();


Brain.Screen.newLine();
Brain.Screen.print("User Program has Ended.");
                  
while(1) {
  vex::task::sleep(100);

}

task::sleep(1000);

why doesn’t it work?

Assuming this is your entire code and that you are not using the competition template, the code should be inside int main()

int main(){
vex::task::sleep(2000);
Brain.Screen.print(“User Program has Started.”);
LeftFront.setVelocity(50, vex::velocityUnits::pct);
RightFront.setVelocity(50, vex::velocityUnits::pct);
LeftFront.spin(vex::directionType::fwd);
RightFront.spin(vex::directionType::fwd);
vex::task::sleep(3000);
LeftFront.stop();
RightFront.stop();
Brain.Screen.newLine();
Brain.Screen.print("User Program has Ended.");
while(1) {
  vex::task::sleep(100);
}
task::sleep(1000);
}

After the brain prints out User Program has Ended it will run through the while loop infinite times. (It will keep running vex::task::sleep(100); forever)

4 Likes

I had the same issue on a competition template. Turns out a curly bracket was missing.