Driver control programming help

Helllo! How do I program my button so that when I click a button the drivetrain move forward 2 revolutions?

Like i want to run part of my auton during driver control by pressing a button.

Thank you

VC, VCS, or PROS

20 char

I am using vex codee

why did u delete it when u could have edited ur comment

Here’s an excerpt from our code, note that this is all in a while loop to continually check if the button is bring pressed:

if (Controller1.ButtonL1.pressing()) {
      ArmMotor.spin(forward, 100, pct);
}

Additionally, if you want to run the rest of your program simultaneously, you could try threading like so:

if (StackBumper.pressing() == true && StackerRunning == false) {
        thread(stackfunction).detach();
}
2 Likes

Thank you solo much!

I didnt know how to do it😅

u c the little pencil on every one of ur comments

Can I make it so that the motors spins certain amount of degrees?

click or press the pencil then u can edit ur comment

1 Like

Ohhhhhhh thank you!!

sure! Here’s an example of that.

RightMotor.rotateFor(cmdistance(10), rotationUnits::rev);

This is a blocking command as it stands, so if you want the rest of your code to run before this finishes you need to thread it through a function or add the boolean param

3 Likes

yeah forums r to help others. plus it helps all the clutter. cause i mean u think anyone would want to read ur thread if every other comment is a deleted one
i swear if someone flags this post. this is on topic cause he didnt know how to edit and im helping him

1 Like

Thank you so much for your help

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