
Set braking
Arguments
Mode:
normal or now
Motor:
a motor number
Brake amount
: from 0 to 800
Response
None
Arduino library
void setBraking(uint8_t motor, uint16_t amount)
void setBrakingNow(uint8_t motor, uint16_t amount)
Command encoding:
0xB1 for normal mode
0xB2 for now mode
motor lower 7 bits of brake amount upper 7 bits of brake amount
Description:
The
motor
argument should be between 1 and the number of motors that your Motoron supports.
If it is invalid, the Motoron reports a protocol error.
The
brake amount
argument should be a number between 0 and 800. If it is larger than 800,
the Motoron will change it to 800. This command sets the “Target brake amount” variable of the
specified motor to the value of this argument. A value of 0 corresponds to full coasting, while a
value of 800 corresponds to full braking. However, due to hardware limitations, the resulting brake
amount might be different from what is specified. See the documentation of the “Target brake
amount” variable in
for more details.
The
mode
argument specifies when and how to apply the specified brake amount:
•
Normal mode:
The motor’s “Target speed” is set to 0. The “Current speed” will start
moving towards the target speed, obeying deceleration limits. When it reaches zero, the
specified brake amount will be used.
•
Now mode:
The motor’s “Target speed” and “Current speed” are set to 0 so the desired
brake amount will be applied immediately.
Here is some example C/C++ code that will generate the correct bytes, given integers
motor
and
amount
:
1
2
3
4
command[0] = 0xB1;
// Set braking, normal mode
command[1] = motor & 0x7F;
command[2] = amount & 0x7F;
command[3] = (amount >> 7) & 0x7F;
Pololu Motoron Motor Controller User’s Guide
© 2001–2022 Pololu Corporation
9. Command reference
Page 64 of 67