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 freescal_cup_k22f
Diff: source/main.cpp
- Revision:
- 6:a4e49784b533
- Parent:
- 5:4d1a524433ca
- Child:
- 12:3384196374ca
--- a/source/main.cpp Tue Jan 13 16:35:04 2015 +0000 +++ b/source/main.cpp Tue Jan 13 17:03:09 2015 +0000 @@ -47,10 +47,19 @@ { max_detect=j; } + } + // Réduction de la vitesse moteur si l'angle du servo augmente + if (max_detect>64) + { + consigne_moteur_1=6-(max_detect-64)/20.; + consigne_moteur_2=6-(max_detect-64)/15.; } - - //servo = float(min_detect-indexMin)/float(indexMax-indexMin); - servo = 1.6*(double(max_detect)/128.-0.5)+0.5; + else + { + consigne_moteur_1=6-(64-max_detect)/15.; + consigne_moteur_2=6-(64-max_detect)/20.; + } + servo = 1.4*(double(max_detect)/128.-0.5)+0.5; } }