Lista della spesa:

01 Arduino
01 Sensore DHT-11 con elettronica
01 Display 1602 con seriale I2C
01 Breadboard e cavetti dupont (opzionali ma comodo averli)

Schama elettrico:

Codice:

#include <dht11.h>
#include <LiquidCrystal_I2C.h>

dht11 DHT11;

#define DHT11_PIN 7

LiquidCrystal_I2C lcd(0x27,16,2);

void setup(){
Serial.begin(9600);
lcd.init(); // initialize the lcd
}

void loop()
{
int chk = DHT11.read(DHT11_PIN);
Serial.print(“Temperature = “);
Serial.println(DHT11.temperature);
Serial.print(“Humidity = “);
Serial.println(DHT11.humidity);
lcd.backlight();
lcd.setCursor(0,0);
lcd.print(“Temp. “);
lcd.print((char)223);
lcd.print(“C = “);
lcd.print(DHT11.temperature);
lcd.setCursor(0,1);
lcd.print(“Umidita’ % = “);
lcd.print(DHT11.humidity);
delay(1000);
}