
“Target brake amount” is also set to 800.
•
Now mode:
The motor’s “Target speed” and “Current speed” are changed, so the motor
outputs will change immediately. The “Target brake amount” is also set to 800.
•
Buffered mode:
The motor’s “Buffered speed” is set. You can use the “Set all speeds
using buffers” command to make it take effect.
Here is some example C/C++ code that will generate the correct bytes, given integers
motor
and
speed
:
Set all speeds
Arguments
Mode:
normal, now, or buffered
Speed for each motor
: from −800 to 800
Response
None
Arduino library
void setAllSpeeds(int16_t speed1, ...)
void setAllSpeedsNow(int16_t speed1, ...)
void setAllBufferedSpeeds(int16_t speed1, ...)
Command encoding:
0xE1 for normal mode
0xE2 for now mode
0xE4 for buffered mode
lower 7 bits of speed 1 upper 7 bits of speed 1 …
Description:
This command is equivalent to the “Set speed” command, but it sets the speed of all the motors
at the same time. This command takes one speed argument for each motor supported by the
controller. Each speed argument is encoded as two bytes, using the same speed encoding as the
“Set speed” command. The speeds are sent in order by motor number, starting with the speed for
motor 1.
If CRC for commands is
not
enabled, it is OK to send extra speeds. They will be ignored since
their most significant bit is 0.
1
2
3
4
command[0] = 0xD1;
// Set Speed, normal mode
command[1] = motor & 0x7F;
command[2] = speed & 0x7F;
command[3] = (speed >> 7) & 0x7F;
Pololu Motoron Motor Controller User’s Guide
© 2001–2022 Pololu Corporation
9. Command reference
Page 62 of 67