Library version for DC_Stepper_Controller_Lib with PWM speed control
Dependents: DR-ArmServoTest Auto_DC_pick_class MBed_TR1 ros_button_2021
DC_Motor_Controller.h@10:fe56f6800a72, 2021-05-25 (annotated)
- Committer:
- stivending
- Date:
- Tue May 25 07:24:10 2021 +0000
- Revision:
- 10:fe56f6800a72
- Parent:
- 9:49b59b308767
- Child:
- 13:675456f1f401
pwm speed control added, 0.0 to 1.0;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
stivending | 5:c040faf21e07 | 1 | #include "mbed.h" |
stivending | 5:c040faf21e07 | 2 | #include "QEI.h" |
stivending | 7:6e59ed00a6a9 | 3 | #include <cmath> |
stivending | 5:c040faf21e07 | 4 | |
stivending | 5:c040faf21e07 | 5 | #ifndef DC_MOTOR_CONTROLLER_H |
stivending | 5:c040faf21e07 | 6 | #define DC_MOTOR_CONTROLLER_H |
stivending | 5:c040faf21e07 | 7 | |
stivending | 5:c040faf21e07 | 8 | class DC_Motor_Controller { |
stivending | 5:c040faf21e07 | 9 | |
stivending | 5:c040faf21e07 | 10 | private: |
stivending | 10:fe56f6800a72 | 11 | PwmOut out1, out2; |
stivending | 9:49b59b308767 | 12 | QEI dc_motor; |
stivending | 10:fe56f6800a72 | 13 | void goto_pulse(int tar_pulse, float speed = 1); |
stivending | 5:c040faf21e07 | 14 | public: |
stivending | 10:fe56f6800a72 | 15 | DC_Motor_Controller(PinName out_M1, PinName out_M2, PinName in_A, PinName in_B, int PPR); |
stivending | 10:fe56f6800a72 | 16 | void goto_angle(int angle, float speed = 1); |
stivending | 9:49b59b308767 | 17 | void reset(); |
stivending | 10:fe56f6800a72 | 18 | void move_angle(int angle, float speed = 1); |
stivending | 10:fe56f6800a72 | 19 | void set_out(float a, float b); |
stivending | 9:49b59b308767 | 20 | int get_pulse(); |
stivending | 5:c040faf21e07 | 21 | }; |
stivending | 5:c040faf21e07 | 22 | #endif |