The exercise was to rotate the motor 360 degrees with 50% power. Without Power Motor Control the motor cannot shoot the ball. With the option turned
on the ball shoots because the motor increases power to overcome the load.
In nxc, when I use:
Code: Select all
RotateMotor(OUT_C, 50, 360);
Code: Select all
SetOutput(OUT_C, Power, 50,
OutputMode, OUT_MODE_BRAKE + OUT_MODE_MOTORON + OUT_MODE_REGULATED,
RegMode, OUT_REGMODE_SPEED
RunState, OUT_RUNSTATE_RUNNING,
UpdateFlags, UF_UPDATE_MODE + UF_UPDATE_SPEED);
To work around this problem I ended up just increasing the power in the
RotateMotor call from 50 to 75. But that felt like cheating.
So my questions are:
1. What's the appropriate way to set and unset the equivalent Power Motor
Control flag?
2. If I wanted to use the SetOutput method, how would I restrict the motor
to a single revolution?
After an email exchange with John Hansen, I created two simple programs, one that has the Power Motor Control option set and one that does not. Both rotate the motor 360 degrees at 50% power. I have attached both rxe files.
Thanks for any tips/help you can provide.
Jeff