#include "DHT.h"
#include "LiquidCrystal_I2C.h"
#define DHTPIN 8
#define DHTTYPE DHT22
const int LedpinA= 13;
const int LedpinV= 7;
const int PinPot= A2;
LiquidCrystal_I2C LCD(0x27, 20,4);
int temp, valPot;
float t;
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// put your setup code here, to run once:
pinMode(LedpinA, OUTPUT);
pinMode(LedpinV, OUTPUT);
pinMode(PinPot, INPUT);
dht.begin();
LCD.backlight();
LCD:init();
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
valPot= analogRead(PinPot);
t=dht.readTemperature();
temp=map(valPot,0,1023,0,80);
LCD.setCursor(0,2);
LCD.print("temperatura");
LCD.print(t);
LCD.setCursor(0,3);
LCD.print("temp impo");
LCD.print(temp);
if(temp>=t){
digitalWrite(LedpinA, HIGH);
digitalWrite(LedpinV, LOW);
}
else{
digitalWrite(LedpinA, LOW);
digitalWrite(LedpinV, HIGH);
}
}