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
25c7cc5b
Commit
25c7cc5b
authored
May 26, 2017
by
Mestari Yousra
Browse files
ajout de avancer, pivoter et etat PLS
parent
8167aac3
Changes
1
Hide whitespace changes
Inline
Side-by-side
main.c
View file @
25c7cc5b
...
...
@@ -16,6 +16,8 @@
#include
"AX12.h"
#include
"AXS1.h"
#include
<math.h>
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
#define P_GOAL_POSITION_L 30
...
...
@@ -261,6 +263,21 @@ void getAngle(unsigned char id, unsigned int* outAngle) {
}
}
void
avancer
(
int
vitesse
){
setSpeed
(
MOTOR_up_left
,
vitesse
);
setSpeed
(
MOTOR_up_right
,
vitesse
);
setSpeed
(
MOTOR_down_left
,
vitesse
);
setSpeed
(
MOTOR_down_right
,
vitesse
);
}
void
pivoter
(
int
rotation
){
setSpeed
(
MOTOR_up_left
,
rotation
);
setSpeed
(
MOTOR_up_right
,
-
rotation
);
setSpeed
(
MOTOR_down_left
,
0
);
setSpeed
(
MOTOR_down_right
,
0
);
}
/////////////////////////////////////////////////////
////////////////////////////// AX S1 ////////////////
/////////////////////////////////////////////////////
...
...
@@ -610,8 +627,18 @@ int main(void)
}
}
while
(
state
==
PLS
){
int
vitesse
=
500
while
(
field
<
thresholdInfrared
){
setSpeed
(
MOTOR_up_left
,
1023
);
setSpeed
(
MOTOR_up_right
,
vitesse
);
setSpeed
(
MOTOR_down_left
,
1023
);
setSpeed
(
MOTOR_down_right
,
vitesse
);
mdelay
(
floor
(
M_PI
/
vitesse
));
vitesse
=
vitesse
+
50
;
}
state
==
START
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