I'm trying to rotate the motor of an EV3 by an angle of 50°. I can't. How I can rotate a NXT/EV3 motor by a given angle using RobotC?
-
Is this a duplicate of your previous question - or have you switched from NXC to RobotC? Are you using the interactive servo motors or the medium/large servo motors?– Zhaph - Ben Duguid ♦Mar 17, 2015 at 11:51
-
Also - can you post an example of what you have tried - RobotC should support sending specific angles to servos assuming you've configured them correctly...– Zhaph - Ben Duguid ♦Mar 17, 2015 at 11:54
-
You can also look at LeJOS - its API for sure allows a motor to turn a specific amount of degrees through the rotate() method. On an instance of a regulated motor this should give you a very accurate rotation.– Phil B.Mar 17, 2015 at 12:16
1 Answer
The command that you are looking for is setMotorTarget as shown in the documentation here.
Essentially, you need to set the target rotation for the motor in degrees and then wait for the movement to take place:
//Sets motorA target to 50 degrees at a speed of 100
setMotorTarget(motorA, 50, 100);
// Waits for movement to complete
waitUntilMotorStop(motorA);