system
5
#include <Wire.h>
#include <RTClib.h>
#include "rgb_lcd.h"
#include <math.h>
rgb_lcd lcd;
const int colorR = 100;
const int colorG = 150;
const int colorB = 255;
int a;
float temperature;
int B=3435; //B value of the thermistor
float resistance;
int c;
float eau;
float resistance2;
RTC_DS1307 RTC;
void setup() {
Wire.begin();
RTC.begin();
lcd.begin(16, 2);
lcd.setRGB(colorR, colorG, colorB);
}
void loop() {
DateTime now = RTC.now();
lcd.setCursor(0, 1);
lcd.print(now.hour());
lcd.print(":");
if (now.minute() < 10) {
lcd.print("0");
}
lcd.print(now.minute());
lcd.print(":");
if (now.second() < 10) {
lcd.print("0");
}
lcd.print(now.second());
lcd.setCursor(0, 0);
lcd.print(now.day());
lcd.print("/");
switch (now.month()) {
case 1:
lcd.print("01");
break;
case 2:
lcd.print("02");
break;
case 3:
lcd.print("03");
break;
case 4:
lcd.print("04");
break;
case 5:
lcd.print("05");
break;
case 6:
lcd.print("06");
break;
case 7:
lcd.print("07");
break;
case 8:
lcd.print("08");
break;
case 9:
lcd.print("09");
break;
case 10:
lcd.print("10");
break;
case 11:
lcd.print("11");
break;
case 12:
lcd.print("12");
break;
}
lcd.print("/");
lcd.print(now.year());
delay(1000);
{
a=analogRead(1);
resistance=(float)(1023-a)*10000/a; //get the resistance of the sensor;
temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;//convert to temperature via datasheet ;
lcd.setCursor(11, 0);
lcd.print((char)223);
lcd.print("C:");
lcd.println(temperature);
}
{
c=analogRead(0);
resistance2=(float)(1023-c)*10000/c; //get the resistance of the sensor;
lcd.setCursor(10, 1);
lcd.print("H:");
lcd.println(c);
}
delay(600000);
lcd.clear();
StoreStatue();
}
void StoreStatue() {
if (c < 200)
{
lcd.setCursor(0, 0);
lcd.print("fermer store");
delay(5000);
lcd.clear();
}
if ((now.month() <= 3) || (now.month() >= 10))
{
lcd.setCursor(0, 0);
lcd.print("fermer store");
delay(5000);
lcd.clear();
}