Moteurs
Dependencies: Encoder_Nucleo_16_bits PwmIn mbed
Fork of Automate by
Diff: function_library.h
- Revision:
- 9:168226ff8f76
- Parent:
- 8:ad8b64ca548d
--- a/function_library.h Fri Jun 09 17:06:05 2017 +0000 +++ b/function_library.h Fri Jun 09 19:38:56 2017 +0000 @@ -272,4 +272,21 @@ *LD2_dist = 59.175/(LD2_val*3.3-0.0275); if (*LD2_dist > 150) *LD2_dist = 150; } +} + +void motor_command(int mg_command, int md_command, int* mg_pwm, int* md_pwm, int* mg_sens, int* md_sens) { + if(mg_command > 0) { + *mg_sens = 1; + *mg_pwm = mg_command; + } else { + *mg_sens = -1; + *mg_pwm = -mg_command; + } + if(md_command > 0) { + *mg_sens = 1; + *md_pwm = md_command; + } else { + *md_sens = -1; + *md_pwm = md_command; + } } \ No newline at end of file