![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Library version for DC_Stepper_Controller_Lib with PWM speed control
Dependents: DR-ArmServoTest Auto_DC_pick_class MBed_TR1 ros_button_2021
Diff: DC_Motor_Controller.h
- Revision:
- 10:fe56f6800a72
- Parent:
- 9:49b59b308767
- Child:
- 13:675456f1f401
--- a/DC_Motor_Controller.h Tue May 25 06:17:55 2021 +0000 +++ b/DC_Motor_Controller.h Tue May 25 07:24:10 2021 +0000 @@ -8,17 +8,15 @@ class DC_Motor_Controller { private: - DigitalOut out1, out2; + PwmOut out1, out2; QEI dc_motor; - + void goto_pulse(int tar_pulse, float speed = 1); public: - 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){} - - void goto_angle(int angle); + DC_Motor_Controller(PinName out_M1, PinName out_M2, PinName in_A, PinName in_B, int PPR); + void goto_angle(int angle, float speed = 1); void reset(); - void move_angle(int angle); - void set_out(int a, int b); + void move_angle(int angle, float speed = 1); + void set_out(float a, float b); int get_pulse(); }; #endif \ No newline at end of file