Modifications

Sauter à la navigation Sauter à la recherche
312 octets ajoutés ,  20 mai 2014 à 10:52
Ligne 78 : Ligne 78 :  
      
 
      
 
int8_t readContact(uint8_t TrinketPin)
 
int8_t readContact(uint8_t TrinketPin)
// returns the number corresponding to sensor values.
+
// Retourne une valeur numérique correspondant aux valeurs du senseur.
// TrinketPin is the analog pin on the Trinket (A1=#2, A2=#4, A3=#3)
+
// Les broches du Trinket sont en analogique (A1=#2, A2=#4, A3=#3)
 
{
 
{
   const int variance = 8; // Analog readings can vary, use this value for +- variance
+
   const int variance = 8; // Les lectures analogiques peuvent varier un petit peu.
 +
                          // utilisons la valeur +-variance pour tenir compte de la divergence
 
   int contact = 0;
 
   int contact = 0;
 
   uint16_t readval = 0;
 
   uint16_t readval = 0;
   readval = analogRead(TrinketPin); // Check the pin
+
   readval = analogRead(TrinketPin); // Lecture de la broche
 
   #ifdef DEBUG
 
   #ifdef DEBUG
   Serial.print(": Sensor read value: ");
+
   Serial.print(": valeur lue sur le senseur: ");
 
   Serial.println(readval);
 
   Serial.println(readval);
 
   #endif
 
   #endif
   for(uint8_t i=0; i<states; i++) { // if reading is near state value, return that state
+
   for(uint8_t i=0; i<states; i++) {  
 +
      // Si la valeur lue est proche d'une valeur d'un état (state), alors retourner l'identification
 +
      // de l'état
 
       if(readval >= (values[i]-variance) && readval <= (values[i]+variance) ) {
 
       if(readval >= (values[i]-variance) && readval <= (values[i]+variance) ) {
 
         return(i);
 
         return(i);
 
       }
 
       }
 
   }
 
   }
   return -1; // value not one of the alarm system values
+
   return -1; // La valeur ne correspond pas à une alarme système
 
}
 
}
 
      
 
      
// This routine toggkes a pin the number you pass. Good to use on LED pin to
+
// Cette fonction fait clignoter une broche du nombre de fois indiqué.  
// output which sensors are triggered
+
// Utile pour brancher une LED sur une broche afin de d'indiquer et
 +
// identifier quel senseur à été déclenché
 
void Blink(uint8_t pin, uint8_t times) {
 
void Blink(uint8_t pin, uint8_t times) {
 
   for(uint8_t i=1; i<=times; i++) {
 
   for(uint8_t i=1; i<=times; i++) {
Ligne 108 : Ligne 112 :  
}</nowiki>
 
}</nowiki>
   −
Remember to comment out the DEBUG line for your final installation.  
+
N'oubliez pas de remettre la ligne DEBUG débug en commentaire pour lors de l'installation finale.  
    
{{Trinket-Alarme-TRAILER}}
 
{{Trinket-Alarme-TRAILER}}
29 918

modifications

Menu de navigation