Adafruit_Motor_Shield_V2_Library
Adafruit_Motor_Shield_V2_Library copied to clipboard
Fix stepper RPM issues with step().
Arduino delayMicroseconds() doesn't work for values larger than about 16K and this broke the step() delay calculation causing almost random speed results for many RPM settings. Added longDelayMicrosecond() function to resolve this.
Also added timing of I2C overhead with delay time adjustments to allow RPM values to be very close to what they are set for, even when I2C bus rates are changed.
Include of Adafruit_MS_PWMServoDriver.h changed in Adafruit_MotorShield.cpp to be consistent with other uses. (not needed for RPM fix -- just seemed "broken" -- ok, it's risky changing something that isn't broken, I know).
I've tested this only an an Arduino Mega 2560 with a V2.3 Adafruit Motor control board.
I ran into this same exact issue on an Arduino Uno with V2.3 Adafruit Motor Control board. Thanks for solving.