Counting In Degrees

Is there any way to make an arm function like this:

int degreesnum = 0;

if (MasterController.ButtonL2.pressing()) {
LeftBarMotor.spin(directionType::rev, 50 , percentUnits::pct); RightBarMotor.spin(directionType::rev, 50 , percentUnits::pct);

track the arm position in degrees rather than just a regular number?

That code does not measure degrees, but intervals through your loop.

There are motor.rotateTo commands - they make your motor rotate to a specified degree based off of the motor’s IME.
Additionally, you can utilize the IME by itself by calling motor.position(degrees); , which will return the number of degrees that the motor has gone

1 Like

Thank You very much Deicer!

was exactly the kind of thing I was looking for!

You Might have accounted for this but if the arm is geared you may want to do degrees * gear ratio to get arm degree.