View difference between Paste ID: xL4f3Hfz and MYJf2CHJ
SHOW: | | - or go back to the newest paste.
1
 //Inclusion bibliothèques
2
#include <LiquidCrystal.h>
3
4
5
//Creation Objet lcd pour le LCD
6
LiquidCrystal lcd(12,11,5,4,3,2);
7
8
9
//definition des pins utilisées
10
const int fan1 = 6; 
11
//Variables globales 
12
unsigned long temps_Anterieur = 0;
13
unsigned long temps_Actuel;
14
const unsigned long periode = 4000; // duree en milliseconde 
15
float val=24; // valeur de la temperature lue
16
 
17
void setup ()
18
{ 
19
lcd.begin (16,2); //initialisation LCD
20
pinMode(8,INPUT);
21
pinMode(fan1,OUTPUT); 
22
}
23
void loop ()
24
{ 
25
if (digitalRead (8 )) 
26
val= val+0.8; 
27
if (val > 29) { val= 24 ;
28
} 
29
//affichage sur LCD
30
lcd.setCursor(0,0);
31
lcd.print ("T :");
32
lcd.print (val);
33
if (val > 26) //Si temperature >26°C,
34
{ 
35
digitalWrite(fan1,LOW ); //demarrage ventilateur 1. 
36
}
37
else if (val < 25) //Si temperature < 25°C,
38
{ 
39-
digitalWrite(fan1,HIGH); //demarrage ventilateur 1.
39+
digitalWrite(fan1,HIGH); //éteindre ventilateur 1.
40
}
41
delay (1000);
42
}