Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed lib_workshop_2019
Revision 9:19255172362f, committed 2019-10-28
- Comitter:
- gvaquette
- Date:
- Mon Oct 28 05:29:08 2019 +0000
- Parent:
- 8:c2d06715025f
- Commit message:
- Version pour whorkshop v2
Changed in this revision
--- a/includes/pin_connexions.h Thu Oct 24 06:06:55 2019 +0000 +++ b/includes/pin_connexions.h Mon Oct 28 05:29:08 2019 +0000 @@ -25,8 +25,6 @@ // Place your Serial declaration here - - /****************************************/ /** CNY declarations **/ /* To be completed */
--- a/main.cpp Thu Oct 24 06:06:55 2019 +0000
+++ b/main.cpp Mon Oct 28 05:29:08 2019 +0000
@@ -42,11 +42,11 @@
do
{
pc.printf("\r CNY_1");
- //ft_print_cny_analog_voltage(CNY1, pc);
+ //ft_print_cny_analog_voltage(cny_1, pc);
pc.printf("\t CNY_2");
- //ft_print_cny_analog_voltage(CNY2, pc);
+ //ft_print_cny_analog_voltage(cny_2, pc);
pc.printf("\t CNY_3");
- //ft_print_cny_analog_voltage(CNY3, pc);
+ //ft_print_cny_analog_voltage(cny_3, pc);
} while (!pc.readable());
pc.printf("\n");
user_choice = ft_get_user_choice(pc);
--- a/src/test_motor/ft_run_motor.cpp Thu Oct 24 06:06:55 2019 +0000
+++ b/src/test_motor/ft_run_motor.cpp Mon Oct 28 05:29:08 2019 +0000
@@ -1,5 +1,7 @@
#include "mbed.h"
#include "test_motor.h"
+#include "console_output.h"
+
/**********************************************************************/
/** ft_run_motor **/
@@ -28,3 +30,30 @@
/* TO DO : apply duty cycle to pwm_mot */
}
+
+
+double ft_get_duty_cycle_choice(Serial pc) {
+ double duty_cycle = 0;
+
+ if (pc.readable() )
+ {
+ int user_int = ft_get_user_int(pc);
+ if (user_int < 10 && user_int >= 0) duty_cycle = user_int/10.0;
+ }
+ return duty_cycle;
+}
+
+void ft_test_motor(PwmOut pin_pwm_mot, DigitalOut pin_dirA, DigitalOut pin_dirB,
+ Serial &pc)
+{
+ e_direction direction = FORWARD;
+
+ double duty_cycle =0.1;
+
+ do{
+ duty_cycle = ft_get_duty_cycle_choice(pc);
+ ft_run_motor(direction, duty_cycle, pin_pwm_mot, pin_dirA, pin_dirB);
+ } while (duty_cycle > 0.0);
+
+ return;
+}
\ No newline at end of file
--- a/src/test_motor/test_motor.cpp Thu Oct 24 06:06:55 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#include "mbed.h"
-#include "test_motor.h"
-#include "console_output.h"
-
-
-
-
-void ft_test_motor(PwmOut pin_pwm_mot, DigitalOut pin_dirA, DigitalOut pin_dirB,
- Serial &pc)
-{
- e_direction direction = FORWARD;
-
- int user_int=1;
- double duty_cycle =0.1;
-
- do{
- if (pc.readable() )
- {
- user_int = ft_get_user_int(pc);
- if (user_int < 10 && user_int >= 0) duty_cycle = user_int/10.0;
- }
-
- ft_run_motor(direction, duty_cycle, pin_pwm_mot, pin_dirA, pin_dirB);
- } while (user_int > 0);
-
- return;
-}
\ No newline at end of file