[RÉSOLU] Mega Projet Contrôleur de Température et d'Humidité

C'est tout bon j'ai bien compris, je ne déclare pas 2 fois la même variable, mon adresse est bien 0x27 (désolé pour mon amateurisme).

Un très grand Merci pour l'exemple, c'est ce dont j'avais besoin
Comme je possède les pièces pour le projet je vais essayé de le réaliser
j'ai qu'un seul DS18B20 en module, pour les boutons et potentiomètre (récup) et l'écran 1602 avec I2C ok c'est tout bon, impeccable vraiment trop fort MERCI.

Voici le code qui fonctionne sans problème, je viens de compilé à l'instant pour faire un montage et notez les disfonctionnements.

En même temps je rédige le code, modifie tout ce que vous m'avez conseillé afin de testé la compilation.

 #include <DHT.h> // inclure les librairies
#include <Wire.h>
#include <LCD.h>
#include <DFR_Key.h> 
#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // 0.27 est l'adresse du bus I2C

const int humidityRelay = 18; 
const int heaterRelay = 19; 
const int DHTPIN = 3; 


int temp = 12;
int hum = 80;
int readkey;
long int lastmillis;
long int hours;
long int minutes;
long int seconds;

char l2c1;
char l2c2;
char l2c3;

DHT dht (DHTPIN, DHT22);

DFR_Key keypad(0); 

int localKey = 0;
String keyString = "";
int lcd_key = 0;
int adc_key_in = 0;

const byte btnRIGHT = 0;  
const byte btnUP = 1;     
const byte btnDOWN = 2;   
const byte btnLEFT = 3;   
const byte btnSELECT = 4; 
const byte btnNONE = 5;   

int read_LCD_buttons() {
  adc_key_in = analogRead(0);
  if (adc_key_in > 1000) return btnNONE;
  if (adc_key_in < 50)   return btnRIGHT;
  if (adc_key_in < 150)  return btnUP;
  if (adc_key_in < 300)  return btnDOWN;
  if (adc_key_in < 460)  return btnLEFT;
  if (adc_key_in < 690)  return btnSELECT;
}

void setup() {
  pinMode(humidityRelay, OUTPUT);
  pinMode(heaterRelay, OUTPUT);
  lcd.begin(16, 2);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Keith control");
  lcd.setCursor(0, 1);
  lcd.print("Instr on Select");
  delay(2500);
  Serial.begin(9600);
  dht.begin();
  delay(1000);
  lcd.clear();

  keypad.setRate(10);
  digitalWrite(humidityRelay, HIGH);
  digitalWrite(heaterRelay, HIGH);

}

void loop() 

{
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  if (isnan(t) || isnan(h)) 

{ 
                              
    lcd.begin(16, 2);
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Capteur N/C!!");
    delay(10000);
} 

else 

{
    lcd_key = read_LCD_buttons();
    switch (lcd_key) {
      case btnLEFT:
        {
          temp = temp + 1;
          break;
        }
      case btnRIGHT:
        {
          temp = temp - 1;
          break;
        }
      case btnUP:
        {
          hum = hum + 1;
          break;
        }
      case btnDOWN:
        {
          hum = hum - 1;
          break;
        }
      case btnSELECT:
        {
          lcd.begin(16, 2);
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("Hum Up/Down +-1%");
          lcd.setCursor(0, 1);
          lcd.print("Temp L/R +-1");
          lcd.print((char)223);
          lcd.print("C");
          delay (5000);
          break;
        }
    }
    lcd.setCursor(0, 0);
    lcd.print("Hum: ");
    lcd.print(h);
    lcd.print("%");
    lcd.print("(");
    lcd.print(hum);
    lcd.print("%)");
    lcd.setCursor(0, 1);
    lcd.print("Tem: ");
    lcd.print(t);
    lcd.print((char)223);
    lcd.print("(");
    lcd.print(temp);
    lcd.print((char)223);
    lcd.print(")");
    
    int H = 70 + 10;
    if (h < 85) digitalWrite(humidityRelay, LOW);
    else if (h >= H) digitalWrite(humidityRelay, HIGH);
    
    int T = 12 + 2 ;
    if (t < 12 )
      digitalWrite(heaterRelay, LOW);
    else if (t >= T)
      digitalWrite(heaterRelay, HIGH);
  }

}

J'ai beaucoup de modif à faire. Je vous remercie encore pour tout le soutien J-M-L, Respect à vous.