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
Diff: Servo.cpp
- Revision:
- 18:daba0b3777c0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.cpp Fri Jun 07 01:11:01 2019 +0000 @@ -0,0 +1,17 @@ +#include "SaphTeamRacing.h" + +float angle_servo(float *direction) +{ + // Calcul basé sur la régression expérimental pour obetenir l'angle + // le pwm à donner au moteur en fonction de l'angle voulue + + float x, y; + double angle, pwm; + x = direction[0]; + y = direction[1]; + angle = atan2(y, x); // récupration de l'angle en radian + angle = angle*180/3.14; // conversion en degrés + pwm = -13.30*angle + 1376.75; // Formule issue de la régression linéaire + + return pwm; +}