3.a.04. Command 232: Independent Motor Drive with Acceleration (inB = ~inA)

Effect: Causes the specified motor to transition from its current direction and PWM to the desired direction PWM at a rate determined by its corresponding acceleration setting. If the desired motor direction (forward for inA = 0 and reverse for inA = 1) is the same as the current direction and the desired PWM is less than the current PWM, the PWM will be set directly to the desired value during the next PWM-update phase of the mega168 main loop (sometime in the next 10ms). In short, this command will not produce artifical deceleration to slow a motor. The only time the acceleration comes into play is when the PWM is increasing in a specific direction. If this command results in a change of direction, the motor is first stopped by braking low at 100% duty cycle for a duration that can be set using command 188 (Section 3.a.08). The PWM is then linearly incremented from zero to the desired PWM in the desired direction based on the acceleration setting, which can be set using command 208 (Section 3.a.07). Acceleration updates to the PWM are performed 100 times per second if possible. It is important to note that acceleration timing is done using the motor 1 PWM timer, so decreasing motor 1’s PWM frequency below 100Hz will decrease the acceleration update rate.

Values sent: motor (1 bit), inA (1 bit), PWM (8 bits)

command byte = 232 | (motor bit << 2) | (inA bit << 1) | MSB of PWM

data byte = 7 lower bits of PWM byte