Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mestari Yousra
pls
Commits
fd8f5fc1
Commit
fd8f5fc1
authored
May 26, 2017
by
Mestari Yousra
Browse files
CODE DES ETATS
parent
25c7cc5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
main.c
View file @
fd8f5fc1
...
...
@@ -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
)
{}
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment