![](/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
README.txt@20:a0d027b80d2c, 2021-08-16 (annotated)
- Committer:
- howanglam3
- Date:
- Mon Aug 16 15:42:30 2021 +0000
- Revision:
- 20:a0d027b80d2c
- Parent:
- 13:675456f1f401
library_version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
stivending | 13:675456f1f401 | 1 | /******************************************************* |
stivending | 13:675456f1f401 | 2 | DC MODOR CONTROLLER LIBRARY |
stivending | 13:675456f1f401 | 3 | ********************************************************/ |
stivending | 13:675456f1f401 | 4 | |
stivending | 13:675456f1f401 | 5 | ON/OFF and PID CONTROL SUPPORTED |
stivending | 13:675456f1f401 | 6 | |
stivending | 13:675456f1f401 | 7 | 1. Enable/Disable DEBUG_MODE in DC_Motor_Controller.cpp |
stivending | 13:675456f1f401 | 8 | Debug mode will affect the performance! |
stivending | 13:675456f1f401 | 9 | If compliation issue occurs, DELETE this file. |
stivending | 13:675456f1f401 | 10 | |
stivending | 13:675456f1f401 | 11 | 2. Declare a motor by classes to use on/off control or PID control. |
stivending | 13:675456f1f401 | 12 | DC_Motor_On_Off motor(D6,D3,D4,D5,792); // non-PID |
stivending | 13:675456f1f401 | 13 | DC_Motor_PID motor(D6,D3,D4,D5,792); // PID |
stivending | 13:675456f1f401 | 14 | Parameters: PinName out_M1, PinName out_M2, PinName in_A, PinName in_B, int PPR |
stivending | 13:675456f1f401 | 15 | Do NOT use DC_Motor_Controller class! It's only a base class. |
stivending | 13:675456f1f401 | 16 | |
stivending | 13:675456f1f401 | 17 | 3. If using the PID controller, set PID parameters. |
stivending | 13:675456f1f401 | 18 | motor.set_pid(0.008, 0, 0); |
stivending | 13:675456f1f401 | 19 | |
stivending | 13:675456f1f401 | 20 | 4. Motor control methods supported: |
stivending | 13:675456f1f401 | 21 | (speed from 0.0 to 1.0, which will not work in PID controller) |
stivending | 13:675456f1f401 | 22 | void goto_angle(int angle, float speed = 1); // go to absolute angle |
stivending | 13:675456f1f401 | 23 | void move_angle(int angle, float speed = 1); // move for relative angle |
stivending | 13:675456f1f401 | 24 | void reset(); // reset the motor |
stivending | 13:675456f1f401 | 25 | void set_out(float a, float b); // manually set the speed of output |
stivending | 13:675456f1f401 | 26 | int get_pulse(); // get the current pulse |
stivending | 13:675456f1f401 | 27 |