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.
Fork of Nucleo_ServoKnob by
Revision 3:0de66e6f1a80, committed 2016-05-29
- Comitter:
- PasKalou
- Date:
- Sun May 29 19:17:36 2016 +0000
- Parent:
- 2:204230a9177d
- Commit message:
- pr?t ? tester chez antoine
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun May 29 19:07:50 2016 +0000 +++ b/main.cpp Sun May 29 19:17:36 2016 +0000 @@ -22,9 +22,17 @@ AnalogIn knob2(A2); // Create the analog input object AnalogIn knob3(A3); // Create the analog input object - +// presser le bouton B1 pour +// lancer le parcours de test() DigitalIn monBouton(PC_13); + + +//fonction ALLER +//pour déplacer trois servos avec ralentissement à la fin : +//servo0 : position actuelle -> fin0 +//servo1 : position actuelle -> fin1 +//servo2 : position actuelle -> fin0 void aller(float fin0, float fin1) { float debut0 = myservo0.read(); @@ -56,10 +64,11 @@ wait_ms(15); } + + // fonction MAP // pour faire de la translation d'intervalle // i dans [a ; b] devient j dans [c ; d] -// float map (float i, float a, float b, float c, float d) { float j; @@ -67,6 +76,8 @@ return j; } + + // fonctino BEZIER // pour pour passer de 3 intervalles continus // à un seul lissé @@ -92,11 +103,12 @@ return pt[0]; } + + // fonction ALLERPAR // pour le servo0 : intermed00 , intermed01 et fin 0 // pour le servo1 : intermed10 , intermed11 et fin 1 // un paramètre de vitesse au plus c'est grand au plus c'est lent -// void allerPar(float intermed00,float intermed01, float fin0, float intermed10,float intermed11,float fin1, float vitesse) { float debut0 = myservo0.read(); @@ -133,6 +145,9 @@ } + +// fonction TEST +// petit parcours qui se réalise lorsque l'on presse monBouton (B1) void test() { // point de départ @@ -142,9 +157,9 @@ // petite promenade pour monter en 0,5 - 1 - 0,5 //servo 0 et servo 2 : 0.3 -> 1.2 -> 0.5 //servo 1 : 0 -> -0.3 -> 1 - //vitesse : 300 + //vitesse : 250 // - allerPar(0.3 ,1.2, 0.5 , 0, -0.3 , 1, 300); + allerPar(0.3 ,1.2, 0.5 , 0, -0.3 , 1, 250); wait_ms(25); } @@ -152,26 +167,20 @@ int main() { - //calibration +// pour le servo tout merdique arduino : +// myservo1.calibrate(0.00075, 70.0); // Calibrate the servo GROOVE tout petit tout mini myservo0.calibrate(0.00105, 150.0); // Calibrate the servo HDKJ D3015 myservo1.calibrate(0.00105, 150.0); // Calibrate the servo HDKJ D3015 myservo2.calibrate(0.00105, 150.0); // Calibrate the servo HDKJ D3015 myservo3.calibrate(0.00105, 150.0); // Calibrate the servo HDKJ D3015 wait_ms(2000); -// -// pour le servo tout merdique arduino : -// myservo1.calibrate(0.00075, 70.0); // Calibrate the servo GROOVE tout petit tout mini -// - +//boucle while(1) { - // teste l'appuie sur le bouton if (monBouton==0) { test(); } - } - }