-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfourche.cpp
49 lines (42 loc) · 918 Bytes
/
fourche.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
Code gerant la fourche du robot
Auteurs : Jeremy et Aurélien
Derniere modif : 22/07/2012
*/
#include <arduino.h> // Pour la fonction micros()
#include "AFMotor.h" // bibliotheque pour le moteur pas à pas
#include "fourche.h"
#include "constantes.h"
static int x = 1;
static double hauteurFourche = H_MIN;
unsigned long tpsPrec = 0;
// monte la fourche
void monterFourche ()
{
if ((micros() - tpsPrec) > TEMPS_PAS)
{
if (hauteurFourche < H_MAX)
{
//actualisation de la hauteur
hauteurFourche ++;
x = 1;
// verifier le calcul
}
else
{
x = 2;
}
}
}
//baisse la fourche
int baisserFourche (int h)
{
if (hauteurFourche > h)
{
//actualisation de la hauteur
hauteurFourche --;
x = 0;
// verifier le calcul
}
return hauteurFourche;
}