Announcement

Collapse
No announcement yet.

How to program a continuous motor in Teleop with a click of a button?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to program a continuous motor in Teleop with a click of a button?

    In Teleop we wanted to create a program where when we click "A" on the gamepad the motor will keep on running without holding the button. And when we click "B" it stops.

    Right now we made it when we hold the triggers it moves and when we let go it stops. But we don't like it that much.

    If anyone has any suggestions or any code they could share, that would be great.

  • #2
    You might try something like this to use the buttons to set the motor power:

    if (gamepad1.a) {motor.setPower(.5);}
    elseif (gamepad1.b) {motor.setPower(0.);}

    Comment

    Working...
    X