// ARDUINO UNO
#include <LiquidCrystal.h>
#include <DHT.h>
#define DHTpin 7
#define DHTtype DHT11
DHT dht11 (DHTpin, DHTtype);
LiquidCrystal lcd(13,12,11,10,9,8);
void setup() {
// Serial.begin(9600);
dht11.begin();
lcd.begin(16,2);
lcd.clear();
pinMode(2,OUTPUT);//ejemplo q sea un motor
}
void loop() {
int temp,hume;
temp = dht11.readTemperature();
hume = dht11.readHumidity();
if(temp>=20){
digitalWrite(2,HIGH);
}
else {
digitalWrite(2,LOW);
}
if(temp<=90)
{
digitalWrite(2,HIGH);
}
else {
digitalWrite(2,LOW);
}
lcd.setCursor(0,0);
lcd.print("Temperatura ");
lcd.print(temp);
lcd.print("C");
delay(2000);
}
No hay comentarios:
Publicar un comentario