Library version for DC_Stepper_Controller_Lib with PWM speed control

Dependencies:   mbed QEI PID

Dependents:   DR-ArmServoTest Auto_DC_pick_class MBed_TR1 ros_button_2021

Revision:
14:c9611cf036ad
Parent:
13:675456f1f401
Child:
15:87df75ee8731
--- a/DC_Motor_Controller.cpp	Thu May 27 05:43:48 2021 +0000
+++ b/DC_Motor_Controller.cpp	Thu May 27 07:32:49 2021 +0000
@@ -3,7 +3,7 @@
 //************************************************//
 // COMMENT NEXT LINE TO ENABLE/DISABLE DEBUG MODE //
 //                                                //
-                #define DEBUG_MODE                //
+//                #define DEBUG_MODE                //
 //                                                //
 //************************************************//
 
@@ -120,13 +120,14 @@
 DC_Motor_Controller::DC_Motor_Controller(PinName out_M1, PinName out_M2, PinName in_A, PinName in_B, int PPR) : 
             out1(out_M1), out2(out_M2), dc_motor(in_A, in_B, NC, PPR)
 {
+    _ppr = PPR;
     out1.period(0.002);
     out2.period(0.002);
 }
 
 void DC_Motor_Controller::goto_angle(int angle, float speed){      //  Move motor to specific angle from home point
         
-    goto_pulse(((double) angle / 360.0)* (2.0 * 792.0), speed);    //  Calculating target pulse number
+    goto_pulse(((double) angle / 360.0)* (2.0 * _ppr), speed);    //  Calculating target pulse number
 };
     
 void DC_Motor_Controller::reset(){       // Setting home point for increment encoder
@@ -138,7 +139,7 @@
 
 void DC_Motor_Controller::move_angle(int angle, float speed){      //  move for relative distance
     
-    goto_pulse(get_pulse() + ((double) angle / 360.0)* (2.0 * 792.0), speed); 
+    goto_pulse(get_pulse() + ((double) angle / 360.0)* (2.0 * _ppr), speed); 
 };
 
 void DC_Motor_Controller::set_out(float a, float b)