New to VSC Extension. Can I have some help?

This is my first year back in V5. I saw that vexcode text was unsupported so I figured I need to use the visual studio extension. When I was experimenting I ran into two issues. First in an attempt to have a bot go forward, turn, and go forward again in autonomous only the first line of my code will run. I have messed with the optional paramater at the end to see if that helps, but no. Drivetrain.driveFor(5310, mm);
Drivetrain.turnFor(100, degrees);
Drivetrain.driveFor(5000,mm);

The second issue is my attempt to use the drivetrain and control it with the joysticks. Here is the code I attempted:

int main() {

// Create Controller callback events - 15 msec delay to ensure events get registered
Controller1.ButtonL1.pressed(controller_L1_Pressed);
Controller1.ButtonL2.pressed(controller_L2_Pressed);
Controller1.ButtonR1.pressed(controller_R1_Pressed);
Controller1.ButtonR2.pressed(controller_R2_Pressed);
wait(15,msec);

// Configure Arm and Claw motor hold settings and velocity
ArmMotor.setStopping(hold);
ClawMotor.setStopping(hold);
ArmMotor.setVelocity(60, percent);
ClawMotor.setVelocity(30, percent);

// Main Controller loop to set motors to controller axis postiions
while(true){
LeftMotor.setVelocity(Controller1.Axis3.position(), percent);
RightMotor.setVelocity(Controller1.Axis2.position(), percent);
LeftMotor.spin(forward);
RightMotor.spin(forward);
wait(5, msec);
}
}

Any help to understand what I am doing wrong would be greatly appreciated.

1 Like

Vexcode text is not unsupported, it is Vexcode v5 pro is deprecated. You can still use it, but it won’t be receiving future updates.

If the code works for you in vexcode text, I would recommend switching back.

The drive code looks fine, but it’s a better practice to use the spin function with a speed rather than setting the velocity (this is done with .spin(forward, speed, pct); where speed is the variable controlling the percentage speed of the motor).

As for the autonomous code, it’s possible that the first line of code isn’t exiting as a result of the robot not fully completing the task. I’m not sure exactly why it isn’t working.

so you want to drive for over 17 feet ?

3 Likes

The student was supposed to practice with autonomous. They were told to have the bot run a lap around the shop. Hence the distance being so long. I will try your changes monday and post any further questions.

1 Like