Hello,
I am working on my new project “Egg Incubator with Arduino”.
My require is to control a specific temperature and humidity for 7 first days. Than to control another temperature from 7th day to 12th day and another specific temperature and humidity from 12th day to 21th day.
Here is the code. This code is working to control temperature and humidity. Al i want is to control temp. and hum. for specific days. i have started to do something about this but i need your help.
Thanks
==============================================================================
#include <DHT.h>;
#include <LiquidCrystal.h>
#include <MyRealTimeClock.h>
#define DHTPIN 7
#define DHTTYPE DHT21
DHT dht(DHTPIN, DHTTYPE);
int relay1 = 8;
int relay2 = 9;
int Contrast=75;
const byte seconds = 0;
const byte minutes = 0;
const byte hours = 16;
const byte days = 0;
const byte months = 0;
const byte years = 0;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
MyRealTimeClock myRTC(6, 7, 8);
float hum;
float temp;
void setup()
{
Serial.begin(9600);
dht.begin();
pinMode (8, OUTPUT);
pinMode (9, OUTPUT);
myRTC.setDS1302Time(50, 25, 00, 12 , 20, 07, 2020);
analogWrite(6,Contrast);
lcd.begin(16, 2);
}
void loop()
{
hum = dht.readHumidity();
temp = dht.readTemperature();
////////////////////////////////////////
if (days >= 10){
if (temp >= 30.0) {
digitalWrite(relay1, HIGH);
}
else if (temp <= 28.0) {
digitalWrite(relay1, LOW);
}
if (hum >= 60.0) {
digitalWrite(relay2, LOW);
}
else if (hum <= 50.0) {
digitalWrite(relay2, HIGH);
}
}
////////////////////////////////////////
else if (days = 15){
if (temp >= 30.0) {
digitalWrite(relay1, HIGH);
}
else if (temp <= 28.0) {
digitalWrite(relay1, LOW);
}
if (hum >= 60.0) {
digitalWrite(relay2, LOW);
}
else if (hum <= 50.0) {
digitalWrite(relay2, HIGH);
}
}
//////////////////////////////////////
else if (days = 18){
if (temp >= 30.0) {
digitalWrite(relay1, HIGH);
}
else if (temp <= 28.0) {
digitalWrite(relay1, LOW);
}
if (hum >= 60.0) {
digitalWrite(relay2, LOW);
}
else if (hum <= 50.0) {
digitalWrite(relay2, HIGH);
}
}
/////////////////////////////////////
Serial.print("Lagështia e ajrit: ");
Serial.print(hum);
Serial.print("%, Temperatura: ");
Serial.print(temp);
Serial.println(" Celsius");
delay(2000);
lcd.setCursor(0, 0);
lcd.print("Temparatura: ");
lcd.print (temp);
lcd.print (" C");
lcd.setCursor(0, 1);
lcd.print("Lageshtia: ");
lcd.print(hum);
lcd.print(" %");
}