Default mbed pwm doesn't have enough resolution at high frequencies, thats why I implemented VNH5019 Motor carrier with FastPWM.
Fork of VNH5019 by
Diff: VNH5019.cpp
- Revision:
- 8:1458b4da7e56
- Parent:
- 5:b5f360a16354
- Child:
- 9:1709d9b034f7
--- a/VNH5019.cpp Thu Apr 27 11:46:05 2017 +0000 +++ b/VNH5019.cpp Sat May 06 13:12:18 2017 +0000 @@ -14,13 +14,13 @@ { ENDIAG.input(); ENDIAG.mode(PullUp); - PWM.period(0.00025); // 4 kHz (valid 0 - 20 kHz) + PWM.period_us(50); // 4 kHz (valid 0 - 20 kHz) PWM.write(0); INA = 0; INB = 0; } -void VNH5019::speed(float Speed) +void VNH5019::speed(double Speed) { bool Reverse = 0;