Good code?

please review my team’s code and tell me what I can improve on

void usercontrol( void ) {
/* setting velocites */
FrontL.setVelocity( 50, vex::velocityUnits::pct );
FrontR.setVelocity( 50, vex::velocityUnits::pct );
BackL.setVelocity( 50, vex::velocityUnits::pct );
BackR.setVelocity( 50,vex::velocityUnits::pct );
IntakeL.setVelocity( 100, vex::velocityUnits::pct );
IntakeR.setVelocity( 100, vex::velocityUnits::pct );
Pusher.setVelocity( 100, vex::velocityUnits::pct);

while (1) {
  velocityUnits go = velocityUnits::pct;
  Controller1.Screen.clearScreen();
  Controller1.Screen.setCursor(1,1);
  Controller1.Screen.print("let's go champ!!11!1!");

  /* driving */
  FrontL.spin(directionType::fwd, Controller1.Axis3.value(), go);
  FrontR.spin(directionType::fwd, Controller1.Axis2.value(), go);
  BackL.spin(directionType::fwd, Controller1.Axis3.value(), go);
  BackR.spin(directionType::fwd, Controller1.Axis2.value(), go);

 /* intake */
 if (Controller1.ButtonL1.pressing()){
    IntakeL.spin(vex::directionType::fwd, 100, go);
    IntakeR.spin(vex::directionType::fwd, 100, go);
 } else if (Controller1.ButtonR1.pressing()) {
    IntakeL.spin(vex::directionType::rev, 100, go);
    IntakeR.spin(vex::directionType::rev, 100, go);
 } else {
    IntakeL.stop(brakeType::hold);
    IntakeR.stop(brakeType::hold);
 }
    
 /* pusher */
 if (Controller1.ButtonL2.pressing()){
    Pusher.spin(vex::directionType::fwd, 100, go);
 } else if (Controller1.ButtonR2.pressing()) {
    Pusher.spin(vex::directionType::rev, 100 , go);
 } else {
    Pusher.stop(brakeType::hold);
 }

/* stack cubes */
 if (Controller1.ButtonLeft.pressing()){
    Pusher.spin(vex::directionType::fwd, 50, go);
    IntakeL.spin(vex::directionType::fwd, 25, go);
    IntakeR.spin(vex::directionType::fwd, 25, go);
 } else {
    Pusher.stop(brakeType::hold);
    IntakeL.stop(brakeType::hold);
    IntakeR.stop(brakeType::hold);
 }

}
}

1 Like

This post was flagged by the community and is temporarily hidden.

First of all, if you’re going to be posting code use [code ] and [/code ].
Also, if you are wanting to improve and increase your response rate and speed of your drive, I would highly suggest using voltage instead, especially for your drivetrain:

3 Likes