Control an H-Bridge using a PwmOut (enable) and two DigitalOuts (direction select). Does not change PWM Frequency
Diff: Motor.cpp
- Revision:
- 3:0394af44cf3e
- Parent:
- 2:f265e441bcd9
--- a/Motor.cpp Tue Nov 23 16:16:43 2010 +0000 +++ b/Motor.cpp Mon Sep 23 19:48:36 2019 +0000 @@ -28,7 +28,7 @@ _pwm(pwm), _fwd(fwd), _rev(rev) { // Set initial condition of PWM - _pwm.period(0.001); + //_pwm.period(0.001); _pwm = 0; // Initial condition of output enables @@ -42,5 +42,11 @@ _pwm = abs(speed); } +Motor& Motor::operator= (float val) { + speed(val); + return *this; +} + +