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

Des nouvelles vite fait...

Reussi a compiler avec ce code sans utiliser la methode Macro F et on gagne de la place dans la memoire
Grace a vous J-M-L merci.

#include <DHT.h> 
#include <Wire.h>
#include <LCD.h>
#include <DFR_Key.h> 
#include <LiquidCrystal_I2C.h>

const byte humidityRelay = 10; 
const byte heaterRelay = 11;     
const byte DHTPIN = 2;  
const byte nbColumns = 16;
const byte nbLines   = 2;             

LiquidCrystal_I2C lcd( 0x27, nbColumns, nbLines); 

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;

// Pour DHT22 (AM2023)
DHT dht (DHTPIN, DHT22);

DFR_Key keypad(0); 

int localKey = 0;
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);supprimer
    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 compris qu'il faut que je fasse pas mal d'essais avant d'arriver au but final et encore...
Mais ya moyen comme on dit.

On baisse pas les bras. >:(