Teacher version
Dependencies: mbed lib_workshop_2019
Revision 5:d99659a45cab, committed 2019-10-24
- Comitter:
- gvaquette
- Date:
- Thu Oct 24 03:54:20 2019 +0000
- Parent:
- 4:bf5caf4c0c88
- Commit message:
- Before first student version
Changed in this revision
diff -r bf5caf4c0c88 -r d99659a45cab includes/pin_connexions.h --- a/includes/pin_connexions.h Wed Oct 23 19:25:12 2019 +0000 +++ b/includes/pin_connexions.h Thu Oct 24 03:54:20 2019 +0000 @@ -18,6 +18,10 @@ typedef unsigned short Word; typedef unsigned long lWord; + +/****************************************/ +/* TO DO 1 : Declare the Serial connexion */ +/****************************************/ Serial Pc (PA_2, PA_3, 115200); /****************************************/ @@ -36,13 +40,13 @@ /** Motor by PWM declarations **/ /* To be completed */ -DigitalOut DIR_1G (PC_9); -DigitalOut DIR_2G (PC_8); -DigitalOut DIR_1D (PC_6); -DigitalOut DIR_2D (PC_5); +DigitalOut DIR_1L (PC_9); +DigitalOut DIR_2L (PC_8); +DigitalOut DIR_1R (PC_6); +DigitalOut DIR_2R (PC_5); -PwmOut Pwm_MG (PA_9); -PwmOut Pwm_MD (PA_8); +PwmOut Pwm_ML (PA_9); +PwmOut Pwm_MR (PA_8); /** End of Motor by PWM declarations **/ /****************************************/
diff -r bf5caf4c0c88 -r d99659a45cab main.cpp --- a/main.cpp Wed Oct 23 19:25:12 2019 +0000 +++ b/main.cpp Thu Oct 24 03:54:20 2019 +0000 @@ -65,12 +65,12 @@ break; case LEFT_MOTOR : - ft_test_motor(Pwm_MG,DIR_1G,DIR_2G,pc); + ft_test_motor(Pwm_ML, DIR_1L, DIR_2L, pc); user_choice = ft_get_user_choice(pc); break; case RIGHT_MOTOR: - ft_test_motor(Pwm_MD,DIR_1D,DIR_2D,pc); + ft_test_motor(Pwm_MR, DIR_1R, DIR_2R, pc); user_choice = ft_get_user_choice(pc); break;
diff -r bf5caf4c0c88 -r d99659a45cab src/test_motor/ft_run_motor.cpp --- a/src/test_motor/ft_run_motor.cpp Wed Oct 23 19:25:12 2019 +0000 +++ b/src/test_motor/ft_run_motor.cpp Thu Oct 24 03:54:20 2019 +0000 @@ -1,6 +1,13 @@ #include "mbed.h" #include "test_motor.h" +/**********************************************************************/ +/** ft_run_motor **/ +/* Args : - direction (e_direction): direction to turn the motor */ +/* - duty_cycle (double): duty cycle for the PWM */ +/* - pwm_mot (PwmOut): pin to set the PWM */ +/* - dirA and dirB (DigitalOut): Pins to set the direction */ +/**********************************************************************/ void ft_run_motor( e_direction direction, double duty_cycle, PwmOut pwm_mot, DigitalOut dirA, DigitalOut dirB) { @@ -18,5 +25,6 @@ dirB = 1; } + /* TO DO : apply duty cycle to pwm_mot */ pwm_mot = duty_cycle; }