Commit fd8f5fc1 authored by Mestari Yousra's avatar Mestari Yousra
Browse files

CODE DES ETATS

parent 25c7cc5b
......@@ -625,11 +625,43 @@ int main(void)
if (field<thresholdInfrared/2)
state=SEEKING;
}
while (state == DEPART){
avancer(vitesse);
/* temps = robot/(2*vitesse) */
mDelay(temps);
avancer(0);
pivoter(vitesse);
/* temps_rotation = faire le test */
mDelay(temps_rotation);
state=AVANCER;
}
while (state==AVANCER){
avancer(vitesse);
centerInfraRed(SENSOR, &field);
if(field<thresholdInfrared){
state=DUPER;
}
}
while (state==DUPER){
int k=1;
while(field<thresholdInfrared && k<10){
pivoter(vitesse*pow(-1,k));
/* calculer le temps pour que k=10 corresponde à un demi-tour */
mDelay(k*temps_DUPER);
k++;
centerInfraRed(SENSOR, &field);
}
if(k==10) state = PLS;
else state=AVANCER;
}
while (state==PLS){
int vitesse=500
int vitesse=500;
while (field<thresholdInfrared){
setSpeed(MOTOR_up_left, 1023);
setSpeed(MOTOR_up_right, vitesse);
......@@ -637,8 +669,10 @@ int main(void)
setSpeed(MOTOR_down_right, vitesse);
mdelay(floor(M_PI/vitesse));
vitesse=vitesse+50;
centerInfraRed(SENSOR, &field);
}
state==START
state==DEPART;
}
while (1) {} ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment