Sunteți pe pagina 1din 2

// include the library code:

#include <LiquidCrystal.h>
#include "DHT.h" //Aadimos la libreria con la cual trabaja nuestro sensor
#define DHTPIN 2
nuestro sensor

// Indicamos el pin donde conectaremos la patilla data de

// Descomenta el tipo de sensor que vas a emplear. En este caso usamos el


DHT11
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE); //Indica el pin con el que trabajamos y el tipo de
sensor
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(4, 5, 6, 7, 8, 9);

void setup() {

// set up the LCD's number of columns and rows:


Serial.begin(9600);
lcd.begin(16, 2);
dht.begin();
lcd.print("RED INDUSTRIAL");
}

void loop()
{
int h = dht.readHumidity(); //Guarda la lectura de la humedad en la variable
float h
int t = dht.readTemperature(); //Guarda la lectura de la temperatura en la
variable float t
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
lcd.print("TP:");
lcd.setCursor(3, 1);
lcd.print(t);
lcd.setCursor(9, 1);
lcd.print("HR:");
lcd.setCursor(12, 1);
lcd.print(h);
//Serial.print(t);
Serial.print(h);
//Serial.print(",");
//Serial.print("\n");
delay(1000);
}

S-ar putea să vă placă și