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:
- 21:9430357e777c
- Parent:
- 20:24ebe046ebe9
- Child:
- 22:b5a3688e144b
--- a/source/main.cpp Sat Jan 17 16:51:33 2015 +0000 +++ b/source/main.cpp Sat Jan 17 17:45:52 2015 +0000 @@ -19,9 +19,11 @@ // Initialisation int indexMin=0; - int indexMax=128; + int indexMax=127; int compteur_uart=0; - int max_detect=indexMin; + int max_detect1=indexMin; + int max_detect2=indexMin; + int max_detect=(max_detect1+max_detect2)/2; float Kp_servo = 0; uart.baud(115200); init_led(); @@ -33,7 +35,7 @@ while(1){ readline(); - //passebas(12); + passebas(12); //derivation(); //passebas(4); @@ -59,13 +61,18 @@ compteur_uart =compteur_uart+1; } - for (int j=indexMin; j<indexMax; j++) + for (int j=indexMin; j<=indexMax; j++) { if (pixel1[j]>pixel1[max_detect]) { - max_detect=j; + max_detect1=j; } - } + if (pixel1[j]>pixel2[max_detect]) + { + max_detect2=j; + } + } + max_detect=(max_detect1+max_detect2)/2; // Réduction proportionelle de la vitesse moteur si l'angle du servo augmente if (max_detect>64) {