Command 0x86 (134): Motor M0 Brake
Compact protocol: 0x86, brake amount
Command 0x87: Motor M1 Brake
Compact protocol: 0x87 (135), brake amount
These commands will set the specified motor to variable brake based on the brake amount data byte. When brake amount is zero, the motor outputs are high impedance, which lets the motor turn freely (coast). When brake amount is 127, the motor outputs are both tied to ground, which causes the motor to brake. For values of brake amount between 0 and 127, the motor outputs will PWM between high impedance (coast) and ground (brake), with the percentage of the time the motor spends braking given by
Please note that a brake amount value of 127 always results in full braking, even when the PWM configuration parameter selects for 8-bit resolution. Braking is not affected by the acceleration parameters, and transitioning from brake to drive or vice versa does not produce a change-of-direction “brake duration” (see Section 5.a for more information about these configuration parameters).
You can familiarize yourself with motor coasting and braking using nothing more than a motor. First, with your motor disconnected from anything, try rotating the output shaft and note how easily it turns. Then hold the two motor leads together and try rotating the output shaft again. You should notice significantly more resistance while the leads are shorted together. A brake amount of zero is equivalent to disconnecting your motor and letting it turn freely; a brake amount of 127 is equivalent to shorting the motor leads together. All other brake amount values produce a mixture of the two scenarios.