#include "DHT.h"
#include "RTClib.h"
#include <LiquidCrystal_I2C.h>
#define DHTPIN 2
#define DHTTYPE DHT22
RTC_DS1307 RTC;
LiquidCrystal_I2C lcd(0x27,20,4);
DHT dht(DHTPIN, DHTTYPE);
void setup () {
dht.begin();
lcd.init();
lcd.backlight(); // backlight on
lcd.clear();
lcd.setCursor(0,1);
lcd.print("Caricamento...");
delay(1000);
lcd.setCursor(0,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(1,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(2,2);
lcd.print(char(255));
lcd.setCursor(3,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(4,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(5,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(6,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(7,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(8,2);
lcd.print(char(255));
lcd.setCursor(9,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(10,2);
lcd.print(char(255));
lcd.setCursor(11,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(12,2);
lcd.print(char(255));
lcd.setCursor(13,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(14,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(15,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(16,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(17,2);
lcd.print(char(255));
delay(500);
lcd.setCursor(18,2);
lcd.print(char(255));
lcd.setCursor(19,2);
lcd.print(char(255));
delay(5000);
lcd.clear();
RTC.begin();
if (!RTC.begin ()) {
lcd.print("ERROR!");
lcd.setCursor(0,2);
lcd.print("STOPCODE:");
lcd.setCursor(0,3);
lcd.print("RTC_NOT_FOUND");
while(1);
}
if (!RTC.isrunning ()) {
RTC.adjust(DateTime( __DATE__,__TIME__));
}
}
void loop () {
int t = dht.readTemperature();
int h = dht.readHumidity();
lcd.clear();
lcd.print("Temperatura: " + String (t) +char(0xDF)+ "C");
lcd.setCursor(0,1);
lcd.print("Umidita': "+ String (h) +"%" );
DateTime now = RTC.now();
lcd.setCursor(0,2);
lcd.print("Ora: ");
lcd.print(now.hour());
lcd.print(":");
lcd.print(now.minute());
lcd.print(":");
lcd.println(now.second());
lcd.setCursor(0,3);
lcd.print("Data: ");
lcd.print(now.day());
lcd.print("/");
lcd.print(now.month());
lcd.print("/");
lcd.println(now.year());
delay(1000);
}
FPS: 0
Power: 0.00W
Power: 0.00W