![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tuk tutoriail
Dependencies: mbed lib_workshop_2019
src/test_motor/ft_run_motor.cpp@4:bf5caf4c0c88, 2019-10-23 (annotated)
- Committer:
- gvaquette
- Date:
- Wed Oct 23 19:25:12 2019 +0000
- Revision:
- 4:bf5caf4c0c88
- Child:
- 5:d99659a45cab
testing motors and add comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gvaquette | 4:bf5caf4c0c88 | 1 | #include "mbed.h" |
gvaquette | 4:bf5caf4c0c88 | 2 | #include "test_motor.h" |
gvaquette | 4:bf5caf4c0c88 | 3 | |
gvaquette | 4:bf5caf4c0c88 | 4 | void ft_run_motor( e_direction direction, double duty_cycle, |
gvaquette | 4:bf5caf4c0c88 | 5 | PwmOut pwm_mot, DigitalOut dirA, DigitalOut dirB) |
gvaquette | 4:bf5caf4c0c88 | 6 | { |
gvaquette | 4:bf5caf4c0c88 | 7 | |
gvaquette | 4:bf5caf4c0c88 | 8 | /* TO DO : define direction */ |
gvaquette | 4:bf5caf4c0c88 | 9 | |
gvaquette | 4:bf5caf4c0c88 | 10 | if (direction == FORWARD) |
gvaquette | 4:bf5caf4c0c88 | 11 | { |
gvaquette | 4:bf5caf4c0c88 | 12 | dirA = 1; |
gvaquette | 4:bf5caf4c0c88 | 13 | dirB = 0; |
gvaquette | 4:bf5caf4c0c88 | 14 | } |
gvaquette | 4:bf5caf4c0c88 | 15 | else // direction == BACKWARD |
gvaquette | 4:bf5caf4c0c88 | 16 | { |
gvaquette | 4:bf5caf4c0c88 | 17 | dirA = 0; |
gvaquette | 4:bf5caf4c0c88 | 18 | dirB = 1; |
gvaquette | 4:bf5caf4c0c88 | 19 | } |
gvaquette | 4:bf5caf4c0c88 | 20 | |
gvaquette | 4:bf5caf4c0c88 | 21 | pwm_mot = duty_cycle; |
gvaquette | 4:bf5caf4c0c88 | 22 | } |