Possible Soft Stop in Programming

So, I was programming on the V5 Text application and I wondered is it possible to add a soft stop into my program. A reason for a soft stop is because hard stops seems to burn motors easier. Like something along the lines of this. I have tested a solution like this before but it never worked for some reason if anyone could help that would be nice.

while(Arm.rotation(rotationUnits::deg) > 0 && Arm.rotation(rotationUnits::deg) < 140){
if(Controller1.ButtonR1.pressing()){
Arm.spin(vex::directionType::fwd, speed, vex::velocityUnits::pct);
}
else if(Controller1.ButtonL1.pressing()){
Arm.spin(vex::directionType::fwd, speed*-1, vex::velocityUnits::pct);
}
else Arm.stop(brakeType::brake);
}

Try using coast instead of brake

Arm.stop(brakeType::coast);

There are 3 types of braking with V5:
Coast: stops motor by turning off power (“softest”)
Brake: stops motor instantly (“hard”)
Hold: stops motor instantly and holds it in place (“hardest”)

7 Likes

Do you mean like a limiting angle? There are a few ways to do that but the main idea would look something like this:

 // Take the current position of the Arm as zero
 MOTORNAME.setPosition(0, degrees);

if(Controller1.ButtonB.pressing()) {
In theory, use a startrotateto. This would give you an area to move freely in and stop at that degree when it gets dangerous.
      }

else if { 
         This can be applied for the other directions of the arm. Using the startrotateto also.
      }
   
 else{
Here you can say for the motors to stop when no buttons are being pushed.
}

Sorry I can not give a actual example as I am in car and cannot recall the exact code.