![](/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
DC_Motor_Controller.h@9:49b59b308767, 2021-05-25 (annotated)
- Committer:
- stivending
- Date:
- Tue May 25 06:17:55 2021 +0000
- Revision:
- 9:49b59b308767
- Parent:
- 8:703502486434
- Child:
- 10:fe56f6800a72
good version may 25
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 | 9:49b59b308767 | 11 | DigitalOut out1, out2; |
stivending | 9:49b59b308767 | 12 | QEI dc_motor; |
stivending | 5:c040faf21e07 | 13 | |
stivending | 5:c040faf21e07 | 14 | public: |
stivending | 9:49b59b308767 | 15 | DC_Motor_Controller(PinName out_M1, PinName out_M2, PinName in_A, PinName in_B, int PPR) : |
stivending | 9:49b59b308767 | 16 | out1(out_M1), out2(out_M2), dc_motor(in_A, in_B, NC, PPR){} |
stivending | 5:c040faf21e07 | 17 | |
stivending | 9:49b59b308767 | 18 | void goto_angle(int angle); |
stivending | 9:49b59b308767 | 19 | void reset(); |
stivending | 9:49b59b308767 | 20 | void move_angle(int angle); |
stivending | 9:49b59b308767 | 21 | void set_out(int a, int b); |
stivending | 9:49b59b308767 | 22 | int get_pulse(); |
stivending | 5:c040faf21e07 | 23 | }; |
stivending | 5:c040faf21e07 | 24 | #endif |