weilin
November 21, 2019, 8:29am
7
There are several issues that appear in your code.
First one is semicolon after main, it should be int main() {
The second is you may need to tell motors desired spin velocity.
Third, you need to tell motors to stop when no buttons is pressed.
else if( Controller1.ButtonL1.pressing() )
{
Arm.spin(forward, 70, pct); // at 70%
}
else if( Controller1.ButtonL2.pressing() )
{
Arm.spin(reverse, 50, pct); // at 50%
}
else
{
Arm.stop(hold); // hold arm in place
}
motor.stop() reference: VEX Help
hold does active PID to try to maintain the position: the higher the error the more power it tries to apply to counter the error. “Hold” means exactly that, it will try to hold the motor there. It uses the built-in PID that has been tuned to work for as many different outputs as possible. If it does not work for you, you need to use a custom PID.
brake is passive. It actually shorts the leads of the motor causing it to generate it’s own power making it slow down. However, if you try to turn it,…
Coast does exactly what you think. It will just let the motors move without any power being applied.
The real difference is between brake and hold. Hold fights to get back to position, while brake just resists movement in general.
STORYTIME!!! When one of my kids was making their 6 bar…
First, they used Brake. When they lifted the 6 bar up and applied Brake, the 6 bar slowly lowered itself. The motors resisted the movement but did not bring it back to position.
Then they tried Hold. Th…
So brake is actually a technical term in this case referring to a purely electronic phenomenon. The positive and negative ends are connected and it resists all motion. (assuming I remember correctly) Motors are unable to be spun normally because the generated electricity is “stuck”. Take a 393 motor and short the 2 wires together by touching them against a c channel and you will see it resists motion. You will notice however it doesn’t resist motion infinitely strong, that is due to the efficie…