![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tuk tutoriail
Dependencies: mbed lib_workshop_2019
Diff: src/test_motor/ft_run_motor.cpp
- Revision:
- 4:bf5caf4c0c88
- Child:
- 5:d99659a45cab
diff -r a0e37b8918ac -r bf5caf4c0c88 src/test_motor/ft_run_motor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test_motor/ft_run_motor.cpp Wed Oct 23 19:25:12 2019 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" +#include "test_motor.h" + +void ft_run_motor( e_direction direction, double duty_cycle, + PwmOut pwm_mot, DigitalOut dirA, DigitalOut dirB) +{ + + /* TO DO : define direction */ + + if (direction == FORWARD) + { + dirA = 1; + dirB = 0; + } + else // direction == BACKWARD + { + dirA = 0; + dirB = 1; + } + + pwm_mot = duty_cycle; +}