Modifications

Sauter à la navigation Sauter à la recherche
aucun résumé de modification
Ligne 40 : Ligne 40 :  
       float tempC = (tempVolts - 0.5) * 100.0;
 
       float tempC = (tempVolts - 0.5) * 100.0;
 
       float tempF = tempC * 9.0 / 5.0 + 32.0;
 
       float tempF = tempC * 9.0 / 5.0 + 32.0;
       // ----------------
+
       //         ----------------
       lcd.print("Temp F ");
+
       lcd.print("Temp C          ");
 
       lcd.setCursor(6, 0);
 
       lcd.setCursor(6, 0);
       lcd.print(tempF);
+
       lcd.print(tempC);
 
        
 
        
       // Display Light on second row
+
       // Affiche la luminosité sur la 2ieme ligne
 
       int lightReading = analogRead(lightPin);
 
       int lightReading = analogRead(lightPin);
 
       lcd.setCursor(0, 1);
 
       lcd.setCursor(0, 1);
       // ----------------
+
       //         ----------------
       lcd.print("Light ");
+
       lcd.print("Lumiere        ");
       lcd.setCursor(6, 1);
+
       lcd.setCursor(8, 1);
 
       lcd.print(lightReading);
 
       lcd.print(lightReading);
 
       delay(500);
 
       delay(500);
Ligne 56 : Ligne 56 :  
</nowiki>
 
</nowiki>
   −
I find it useful to put a comment line above the 'lcd' command.
+
J'ai trouvé qu'il était utile de mette l'identification des broches de l'afficheur sur la ligne de commentaire précédent la commande 'lcd'.
    
  <nowiki>//                BS E D4 D5 D6 D7
 
  <nowiki>//                BS E D4 D5 D6 D7
Ligne 62 : Ligne 62 :  
</nowiki>
 
</nowiki>
   −
This makes things easier if you decide to change which pins you use.
+
Cela rend les modifications plus faciles si vous décidez de changer les broches utilisées.
   −
In the 'loop' function there are now two interesting things going on. Firstly we have to convert the analog from the temperature sensor into an actual temperature, and secondly we have to work out how to display them.
+
Dans la fonction 'loop', il y a maintenant deux opérations intéressant qui s'y déroulent. Premièrement, nous convertissons la valeur analogique du senseur de température en "température réelle". En seconde position, nous faisons le nécessaire pour afficher cette valeur.
   −
First of all, lets look at calculating the temperature.
+
Pour commencer, penchons nous sur le calcul de la température.
    
  <nowiki>    int tempReading = analogRead(tempPin);
 
  <nowiki>    int tempReading = analogRead(tempPin);
Ligne 73 : Ligne 73 :  
     float tempF = tempC * 9.0 / 5.0 + 32.0;</nowiki>
 
     float tempF = tempC * 9.0 / 5.0 + 32.0;</nowiki>
   −
The raw reading from the temperature sensor is first multiplied by 5 and then divided by 1024 to give us the voltage (between 0 and 5) at the 'tempPin' analog input.
+
La valeur brute lue depuis le senseur de température est d'abord multipliée par 5 et ensuite divisé par 1024 pour nous fournir la tension (entre 0 et 5v) sur la broche analogique 'tempPin'.
   −
To convert the voltage coming from the TMP36 into a temperature in degrees C, you have to subtract 0.5V from the measurement and then multiply by 100.
+
Pour convertir la tension provenant du TMP36 en degrés Celcuis (en température réelle), il faut soustraire 0.5V à la mesure puis multiplié par 100.
   −
To convert this into a temperature in Fahrenheit, you then have to multiply it by 9/5 and then add 32.
+
Pour convertir la température en degrés Fahrenheit, il faut multiplier par 9/5 puis ajouter 32.
 +
 
 +
'''xxxxxxxxxxxxxx'''
    
Displaying changing readings on an LCD display can be tricky. The main problem is that the reading may not always be the same number of digits. So, if the temperature changed from 101.50 to 99.00 then the extra digit from the old reading is in danger of being left on the display.
 
Displaying changing readings on an LCD display can be tricky. The main problem is that the reading may not always be the same number of digits. So, if the temperature changed from 101.50 to 99.00 then the extra digit from the old reading is in danger of being left on the display.
Ligne 84 : Ligne 86 :     
  <nowiki>    // ----------------
 
  <nowiki>    // ----------------
     lcd.print("Temp F ");
+
     lcd.print("Temp C          ");
 
     lcd.setCursor(6, 0);
 
     lcd.setCursor(6, 0);
     lcd.print(tempF);
+
     lcd.print(tempC);
 
</nowiki>
 
</nowiki>
  
29 917

modifications

Menu de navigation