egg incubator

hi, i am trying to write a program for an incubator that can be set to incubate different types of eggs at a time . can someone help me how to do it? here is a sample code ii had written but it is not working as expected..

#include "DHT.h"
#include <Password.h> 
#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal.h>
#define DHTPIN 22      //arduino pin where the data pin of the sensor is connected to.
#define DHTTYPE DHT22  //define the DHT22 sensor.
DHT dht (DHTPIN,DHTTYPE);   // initialize sensor.

LiquidCrystal lcd (8,9,10,11,12,13); // initialize the LCD.
const byte ROWS = 4; // Four rows
const byte COLS = 3; // Four columns

char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};

// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = {26,27,28,29}; //connect to row pinouts
 
// Connect keypad COL0, COL1, COL2 and COL3 to these Arduino pins.
byte colPins[COLS] = {30,31,32}; //connect to column pinouts

// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); 



int relay1=23;
int relay2=24;
int relay3=25;
float temperature,humidity;
char tempF[6];
char humF[6];
void setup() {
  pinMode (relay1,OUTPUT);
  pinMode (relay2,OUTPUT);
  pinMode (relay3,OUTPUT);
  lcd.begin(20,4);
  welcome();
  dht.begin();
 
}

void loop() {
  lcd.clear();
  char y=   getkey();



  
      switch (y){
       
  case '1': 
            humidity= dht.readHumidity();
            temperature=dht.readTemperature();
            lcd.clear();
 
  
            dtostrf (temperature,3,1,tempF);    // functions to convert sensor readings to string variables for display.
            dtostrf (humidity,3,1,humF);
           
            lcd.setCursor(0,0);
            lcd.print ("Tempeture: ");
            lcd.print (tempF);

            lcd.setCursor(0,1);
            lcd.print ("humidity: ");
            lcd.print (humF);
            lcd.print ("%");
             
            if (humidity >60)
              {
               digitalWrite(relay3,LOW);
              }
            else
              {
                  digitalWrite (relay3,HIGH);
              }
             
            if (humidity <50)
              {
              digitalWrite(relay2,LOW);
              }

           else
              {
               digitalWrite (relay2,HIGH);
              }
           
           delay (500);
break;
     
case '2': 

  humidity= dht.readHumidity();
            temperature=dht.readTemperature();
            
           
 
  
            dtostrf (temperature,3,1,tempF);    // functions to convert sensor readings to string variables for display.
            dtostrf (humidity,3,1,humF);
           
            lcd.setCursor(0,0);
            lcd.print ("Tempeture: ");
            lcd.print (tempF);

            lcd.setCursor(0,1);
            lcd.print ("humidity: ");
            lcd.print (humF);
            lcd.print ("%");
             
            if (humidity >48.5)
              {
               digitalWrite(relay3,LOW);
              }
            else
              {
                  digitalWrite (relay3,HIGH);
              }
             
            if (humidity <40)
              {
              digitalWrite(relay2,LOW);
              }

           else
              {
               digitalWrite (relay2,HIGH);
              }
           
          


break;

case '3':

 humidity= dht.readHumidity();
            temperature=dht.readTemperature();
            
 
  
            dtostrf (temperature,3,1,tempF);    // functions to convert sensor readings to string variables for display.
            dtostrf (humidity,3,1,humF);
           
            lcd.setCursor(0,0);
            lcd.print ("Tempeture: ");
            lcd.print (tempF);

            lcd.setCursor(0,1);
            lcd.print ("humidity: ");
            lcd.print (humF);
            lcd.print ("%");
             
            if (humidity >55)
              {
               digitalWrite(relay3,LOW);
              }
            else
              {
                  digitalWrite (relay3,HIGH);
              }
             
            if (humidity <50)
              {
              digitalWrite(relay2,LOW);
              }

           else
              {
               digitalWrite (relay2,HIGH);
              }
           
           
break;

default: 
         lcd.print("WRONG CHOOICE"); 
         
break;

      
      }
  
  }


    
     
  


void welcome(){
    lcd.clear();
    lcd.print("****WELCOME*****");
    lcd.setCursor(0,1);
    lcd.print("SELECT TYPE OF EGG");
    delay(5000);
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("1: CHICKEN");
    lcd.setCursor(0,1);
    lcd.print("2: DUCKK");
    lcd.setCursor(0,2);
    lcd.print("3: QUAIL");
    delay(500);
    }

char getkey()
{
  lcd.clear();
  char key=keypad.getKey();
  keypad.setDebounceTime(250);
  if (key!=NO_KEY)
      return key;
   else
   lcd.print("NO KEY PRESSED");
 
  }

At least let us know what it does and does not do. As well as what you want it to do.

Two lines and code to work out is not a lot of help.

Weedpharma

               digitalWrite (relay2,HIGH);
              }
           
           delay (500);
break;
     
case '2':

Fix your piss-poor indenting by using Tools + Auto Format.

Why do you read the temperature (THAT is the correct spelling) and humidity in every case? Reading the temperature and humidity, and displaying that data on the LCD is NOT case dependent.

Why is the Password library included? It is not used.

Many of your global variables should NOT be global.

PaulS:
Why is the Password library included? It is not used.

future probably... you know those pesky racoons... set the temp to chicken and get hard boiled quail eggs.

@nzioka,

If you monitor the Forum and respond to questions quickly it stops people wandering off with idle (if humourous) speculations.

...R