Announcement

Collapse
No announcement yet.

stopping a motor

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

  • stopping a motor

    Is there a way to stop a motor and have it brake instead of float?

  • #2
    What are you using in your code? I would think the easiest is to set the power to zero. Here are few suggestions.
    // stop motors with brakes on.
    motorA.stop(); or motorA. setPower(0);

    Comment


    • #3
      motorName.setZeroPowerBehavior(DcMotor.ZeroPowerBe havior.BRAKE); -- This will "put the brakes on" with motorName.setPower(0)

      motorName.setZeroPowerBehavior(DcMotor.ZeroPowerBe havior.FLOAT); -- This will coast with motorName.setPower(0)

      Comment


      • #4
        Would we put that in the hardware program or in the op mode itself?

        Comment


        • #5
          FLARE would we put that in hardware or in the op mode?

          Comment


          • #6
            You can put that in with your other hardware initialization. So you'd have something like:
            Code:
            motorName = opMode.hardwareMap.get(DcMotor.class, "​​​​​​​motorName");
            ​​​​​​​motorName.setDirection(DcMotor.Direction.FORWARD);
            ​​​​​​​motorName.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
            motorName.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);

            Comment


            • #7
              FLARE Thank You!

              Comment


              • #8
                To clarify braking, it slows the motor rapidly, it does not hold the motor in position once stopped.

                Comment

                Working...
                X