I wanted to find out how make a v5 smart motor work as a servos with a triple shot function
What do you want the motor to do? The smart motor already let you control it like a servo, that is what VEX implies by calling it “smart”.
You can set it to move by a certain amount of degrees or rotations if that is what you are looking for?
if you want it to be like a servo in that it knows its position even after being powered off, and can only move a certain amount of degrees, you can attach a potentiometer to the front of the motor. However, i don’t see how that would be beneficial because of what @7686B_Ian and @tabor473 said, the motors are already smart motors, so they can see their position.
I want it to stay at a set position and when a button X is pressed I want it to flick forward and go back to its set position with no wait time
then have it spin forward for a set amount of degrees, then have it go back the same amount of degrees
like so
if you want to copy this here’s the code in plaintext
Motor.setVelocity(80, percent);
Motor.spinFor(forward, 360, degrees);
Motor.setVelocity(40, percent);
Motor.spinFor(reverse, 360, degrees);
just put this inside the button code in your driver control section (if you use comp template or made your own) and you’re set.
Change the braking mode on the motor to “hold”, this will make the motor stay in one place.