Stopping smart motor at certain degree

My team has built the MOBY bot and we are trying to find a way to program the 2 front motors to stop at a certain number of degrees, that way we don’t accidently break anything. We are a young team so we are using the blocks software.

We tried using a bumper switch but we could only program that to make the controller vibrate when the switch contacted the ground. We were not to happy with that result.

For example, our front left motor is at -545 degrees when the lifting mechanism is touching the ground. Our right motor is at +545 degrees. Is there a way to tell the motors to stop rotating when they hit that point?

Yes there is a way to do this. Use rotateto.

Coincidentally I just helped out my sister team with this problem, and yes there is a fix.
Here’s what you could do:

If -545 degrees is when the lift hits the ground you should set it somewhere a bit higher than the ground, I would also recommend setting the liftMotor’s rotation to zero degrees at the start of the match and then modifying the degrees it stops and starts at. I’m currently using V5 text to program, but I’m pretty sure this will work. If you need help feel free to pm me.

1 Like

i would suggest adding a potentiometer so that it doesn’t matter where the arm starts