Servo Controller and Arduino

What are the differences between command 4 and command 5?Also, why do we need two bytes for the data? I would think that only one byte would be needed to set the angle.

Do you mean the difference between command 3 (set 8-bit position) and command 4 (set absolute position)?

Command 4 (set absolute position) is a high resolution servo position command that isn’t affected by any of the servo configuration commands, (except for Command 1, set speed, which changes how quickly the servo moves to the commanded position, but not the location of that final position). Commands 2 (set 7-bit positoin) and 3 (set 8-bit position) are lower resolution position commands that are affected by the configuration commands.

In a way commands 2 and 3 generate values for command 4. For example, if I command position using command 3 (set 8-bit position), that position is scaled and possibly reversed by the range and direction parameters set by command 0 (set parameters), then offset by the neutral position set in command 5 (set neutral), into an absolute (command 4-style) position that is used to generate the position signal for the servo.

The Pololu protocol uses the high bit of an 8-bit byte to signify the start of a command, so no other bytes in the command can use the high bit. This means each byte has only 7 effective bits, so one position byte can only represent 128 distinct positions. Command 3 lets you specify 256 positions, and command 4 lets you specify 5000 positions (even though your servo won’t have nearly that resolution), so they need to split the position number up into two bytes.

I hope that clears everything up.

-Adam