summaryrefslogtreecommitdiff
path: root/n
diff options
context:
space:
mode:
Diffstat (limited to 'n')
-rw-r--r--n/es/src/main.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/n/es/src/main.c b/n/es/src/main.c
index 3802523..2394884 100644
--- a/n/es/src/main.c
+++ b/n/es/src/main.c
@@ -48,6 +48,7 @@ uint8_t mesure;
uint8_t ascenseur;
uint8_t ventouse;
uint8_t pont;
+uint8_t nb_valeur_socle = 0;
int main (void)
{
@@ -94,7 +95,8 @@ int main (void)
temp_sens = sens; // permet de savoir quand on a fini un tour
}
TIMSK |= 0x04;
- if(mesure == 1)
+
+ if(mesure == 1) // activation des fonctions lié au capteur de proximité
{
tableau_longueur[2]=tableau_longueur[1];
tableau_longueur[1]=tableau_longueur[0];
@@ -108,7 +110,8 @@ int main (void)
// proto_send1w ('P','0');
TournerTourelle();
}
- if(pont == 1)
+
+ if(pont == 1) // activation des fonctions associées au pont
{
for(compteur=0;compteur<3;compteur++)
{
@@ -119,11 +122,13 @@ int main (void)
twi_update ((uint8_t *) tableau_sharp,6); // renoie des valeurs sur le I2C
}
}
- if(ascenseur == 1)
+
+ if(ascenseur == 1) // activation des fonctions liées à l'ascenseur
{
ascenseur_update ();
}
- if (ventouse)
+
+ if (ventouse) // desactivation automatique de la ventouse (remet l'aimantage)
{
ventouse--;
if (!ventouse)
@@ -131,6 +136,27 @@ int main (void)
PORTB &= ~_BV (1);
}
}
+
+ if (socle) // active les fonctions liées au socle.
+ {
+ adc_start (pin_socle1); // pin socle1 sélectionnée
+ while(!adc_checkf()){}
+ valeur_socle1 = adc_read();
+
+ adc_start (pin_socle2); // pin socle2 sélectionnée
+ while(!adc_checkf()){}
+ valeur_socle2 = adc_read();
+
+ nb_valeur_socle++;
+ if(valeur_socle1 > SEUIL_SOCLE || valeur_socle2 > SEUIL_SOCLE) tableau_socle[nb_valeur_socle & 15] = 1;
+ else tableau_socle[nb_valeur_socle & 15] = 0;
+
+
+ for(temp = 0; temp < 16 ;temp++)
+ valeur_socle = tableau_socle[temp];
+
+ twi_update ((uint8_t *) valeur >> 3)
+ }
}
}