Library version for DC_Stepper_Controller_Lib with PWM speed control
Dependents: DR-ArmServoTest Auto_DC_pick_class MBed_TR1 ros_button_2021
main.cpp@7:6e59ed00a6a9, 2021-05-24 (annotated)
- Committer:
- stivending
- Date:
- Mon May 24 08:17:09 2021 +0000
- Revision:
- 7:6e59ed00a6a9
- Parent:
- 5:c040faf21e07
- Child:
- 8:703502486434
f margin of error is less than +-3 pulses (+-0.5 degree), give up; future direction diff from current motion, pause for unexpected outputs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cheukming0607 | 2:6bc435f4ffec | 1 | #include "mbed.h" |
aberk | 0:bcff39fac858 | 2 | #include "QEI.h" |
stivending | 5:c040faf21e07 | 3 | #include "DC_Motor_Controller.h" |
aberk | 0:bcff39fac858 | 4 | |
stivending | 7:6e59ed00a6a9 | 5 | DC_Motor_Controller motor(D2,D3,D4,D5,792); //out1 out2 in1 in2 ppr |
stivending | 7:6e59ed00a6a9 | 6 | // D4 -> INA |
stivending | 7:6e59ed00a6a9 | 7 | // D5 -> INB |
stivending | 7:6e59ed00a6a9 | 8 | // D3 -> IN2 -> M1 |
stivending | 7:6e59ed00a6a9 | 9 | // D2 -> IN1 -> M2 |
stivending | 7:6e59ed00a6a9 | 10 | |
stivending | 4:b242191ed0cf | 11 | |
stivending | 7:6e59ed00a6a9 | 12 | int main() { |
stivending | 7:6e59ed00a6a9 | 13 | |
stivending | 5:c040faf21e07 | 14 | motor.reset(); |
stivending | 7:6e59ed00a6a9 | 15 | /* |
stivending | 7:6e59ed00a6a9 | 16 | motor.set_out(1,0); |
stivending | 7:6e59ed00a6a9 | 17 | wait(5); |
stivending | 7:6e59ed00a6a9 | 18 | motor.set_out(0,1); |
stivending | 7:6e59ed00a6a9 | 19 | wait(5);*/ |
stivending | 7:6e59ed00a6a9 | 20 | |
stivending | 7:6e59ed00a6a9 | 21 | |
stivending | 7:6e59ed00a6a9 | 22 | motor.move_angle(-180); |
stivending | 7:6e59ed00a6a9 | 23 | |
stivending | 7:6e59ed00a6a9 | 24 | wait(3); |
stivending | 7:6e59ed00a6a9 | 25 | |
stivending | 7:6e59ed00a6a9 | 26 | motor.reset(); |
cheukming0607 | 2:6bc435f4ffec | 27 | } |