Bo Han Zhu / Motor

Files at this revision

API Documentation at this revision

Comitter:
bzhu792
Date:
Thu Nov 17 22:17:03 2022 +0000
Parent:
2:f265e441bcd9
Commit message:
Use SoftPWM

Changed in this revision

Motor.cpp Show annotated file Show diff for this revision Revisions of this file
Motor.h Show annotated file Show diff for this revision Revisions of this file
--- a/Motor.cpp	Tue Nov 23 16:16:43 2010 +0000
+++ b/Motor.cpp	Thu Nov 17 22:17:03 2022 +0000
@@ -25,7 +25,7 @@
 #include "mbed.h"
 
 Motor::Motor(PinName pwm, PinName fwd, PinName rev):
-        _pwm(pwm), _fwd(fwd), _rev(rev) {
+        _pwm(pwm, true), _fwd(fwd), _rev(rev) {
 
     // Set initial condition of PWM
     _pwm.period(0.001);
--- a/Motor.h	Tue Nov 23 16:16:43 2010 +0000
+++ b/Motor.h	Thu Nov 17 22:17:03 2022 +0000
@@ -24,6 +24,7 @@
 #define MBED_MOTOR_H
 
 #include "mbed.h"
+#include "SoftPWM.h"
 
 /** Interface to control a standard DC motor 
  *
@@ -47,7 +48,7 @@
     void speed(float speed);
 
 protected:
-    PwmOut _pwm;
+    SoftPWM _pwm;
     DigitalOut _fwd;
     DigitalOut _rev;