Support » Qik 2s9v1 User’s Guide » 5. Serial Commands »
5.e. 0x88 - 0x8F: Set Motor Forward/Reverse
The qik can independently control two bidirectional brushed DC motors, driving each either forward or reverse with either 7- or 8-bit speed resolution. In 7-bit mode, motor speed ranges from stopped to full speed as the speed parameter ranges from 0 to 127. In 8-bit mode, motor speed ranges from stopped to full speed as the speed parameter ranges from 0 – 255. The speed resolution can be controlled by the PWM configuration parameter (see Section 5.c).
The motor direction convention used in this document is that “forward” corresponds to grounding the – pin while PWMing the + pin between VMOT and ground. “Reverse” corresponds to grounding the + pin while PWMing the – pin between VMOT and ground. Notions of “forward” and “reverse” are somewhat arbitrary. See Section 3.a for information about motor and power connections.
Motor M0 Commands
Commands 0x88 – 0x8B apply to motor M0. In 8-bit mode, commands 0x89 and 0x8B will set the motor speed to 128+motor speed; in 7-bit mode, command 0x89 is identical to command 0x88 and command 0x8B is identical to command 0x8A.
For example, in 8-bit mode, the command packet 0x88, 0x7F will set motor M0 speed to 127 out of a maximum of 255, which will result in the motor’s turning at half speed. The command packet 0x89, 0x7F will set motor M0 speed to 127+128 = 255, which will result in the motor’s turning at full speed. In 7-bit mode, both commands will set motor M0 speed to 127 out of a maximum of 127, which will result in the motor’s turning at full speed.
Command 0x88: Motor M0 Forward
Compact protocol: 0x88, motor speed
Pololu protocol: 0xAA, device ID, 0x08, motor speed
Command 0x89: Motor M0 Forward (speed + 128; used in 8-bit mode)
Compact protocol: 0x89, motor speed
Pololu protocol: 0xAA, device ID, 0x09, motor speed
Command 0x8A: Motor M0 Reverse
Compact protocol: 0x8A, motor speed
Pololu protocol: 0xAA, device ID, 0x0A, motor speed
Command 0x8B: Motor M0 Reverse (speed + 128; used in 8-bit mode)
Compact protocol: 0x8B, motor speed
Pololu protocol: 0xAA, device ID, 0x0B, motor speed
Motor M1 Commands
Commands 0x8C – 0x8F apply to motor M1. In 8-bit mode, commands 0x8D and 0x8F will set the motor speed to 128+motor speed; in 7-bit mode, command 0x8D is identical to command 0x8C and command 0x8F is identical to command 0x8E.
For example, in 8-bit mode, the command packet 0x8C, 0x7F will set motor M1 speed to 127 out of a maximum of 255, which will result in the motor’s turning at half speed. The command packet 0x8D, 0x7F will set motor M1 speed to 127+128 = 255, which will result in the motor’s turning at full speed. In 7-bit mode, both commands will set motor M1 speed to 127 out of a maximum of 127, which will result in the motor’s turning at full speed.
Command 0x8C: Motor M1 Forward
Compact protocol: 0x8C, motor speed
Pololu protocol: 0xAA, device ID, 0x0C, motor speed
Command 0x8D: Motor M1 Forward (speed + 128; used in 8-bit mode)
Compact protocol: 0x8D, motor speed
Pololu protocol: 0xAA, device ID, 0x0D, motor speed
Command 0x8E: Motor M1 Reverse
Compact protocol: 0x8E, motor speed
Pololu protocol: 0xAA, device ID, 0x0E, motor speed
Command 0x8F: Motor M1 Reverse (speed + 128; used in 8-bit mode)
Compact protocol: 0x8F, motor speed
Pololu protocol: 0xAA, device ID, 0x0F, motor speed