#include 
LiquidCrystal lcd(33,31,29,27,25,23);

//Define the pins to which the Sensors are Connected

int LDRsensorPin = A0;    //analog pin A0 is used for Light sensor input
int tempsenorPin = A15;    //analog pin A1 is  used for tempsensor input
int lpgsensorPin = A13;    //analog pin A2 is used for lpg sensor input

int firesensor = 39;

//Define the variables to store sensor values:
int LDRvalue;
int tempvalue;
int lpgvalue;

//Define all Output Devices Here
int Fan= 53;
int Alarm=52;
int Light=51;

//int rc_code_lock=A4;

void setup()
{
  pinMode(Fan, OUTPUT);
  pinMode(Alarm, OUTPUT);
  pinMode(Light, OUTPUT);

  pinMode(firesensor, INPUT);

  lcd.begin(16,2);

  lcd.clear();         

  lcd.setCursor(0,0);       
  lcd.print("  SMART  HOUSE  "); 

  lcd.setCursor(0,1);
  lcd.print("  Developed By  ");
  delay(1500);
  lcd.setCursor(0,1);
  lcd.print("  Deepak Kumar  ");
  delay(1500);
  lcd.setCursor(0,1);
  lcd.print("    Amit Kumar    ");
  delay(1500);
  lcd.setCursor(0,1);
  lcd.print(" Smriti Shekhar ");
  delay(1500);
  lcd.setCursor(0,1);
  lcd.print(" Shubham Chaudhary ");
  delay(1500);
  lcd.setCursor(0,1);
  lcd.print("   Suraj Kumar  ");
  delay(1500);
  lcd.setCursor(0,1);
  lcd.print("      and       ");
  delay(1500);
  lcd.setCursor(0,1);

  lcd.print("  Gaurav Kumar  ");
  delay(1500);
  lcd.setCursor(0,1);
  lcd.print("   Guided By    ");
  delay(1500);
  lcd.setCursor(0,1);
  lcd.print(" Debashish  Sir ");
  delay(1500);
  lcd.setCursor(0,1);
  lcd.print("  WELCOMES YOU  ");
  delay(1500);
}

void loop()
{
  lcd.clear(); 
  LDRvalue=analogRead (LDRsensorPin);
  delay(10);
  LDRvalue=analogRead (LDRsensorPin);

  lpgvalue=analogRead (lpgsensorPin);
  delay(10);
  lpgvalue=analogRead (lpgsensorPin);

  tempvalue=analogRead (tempsenorPin);
  delay(10);
  tempvalue=analogRead (tempsenorPin);

  float tempC = (5.0 * tempvalue * 100.0)/1024.0;  //convert the analog data to temperature

  int lpgpercentage = map(lpgvalue, 450, 1000, 0, 100);

  int lightpercentage = map(LDRvalue, 00, 00, 1, 100);

  //The code for Automatic On/Off of Fan is written Below

  if (tempC > 37)
  {
    digitalWrite(Fan,HIGH);
  }else
  {
    digitalWrite(Fan,LOW);
  }

  if (lpgpercentage > 50)
  {
    digitalWrite(Alarm,HIGH);
  }else
  {
    digitalWrite(Alarm,LOW);
  }

  if (lightpercentage < 40)
  {
    digitalWrite(Light,HIGH);
  }else
  {
    digitalWrite(Light,LOW);
  }

  Serial.print("LDRvalue is");
  Serial.println(LDRvalue);

  lcd.setCursor(0,0);       
  lcd.print("  LDRvalue is  "); 

  lcd.setCursor(0,1);
  lcd.print(LDRvalue);

  delay(1500);
  Serial.print("lpgvalue is");
  Serial.println(lpgvalue);

  lcd.setCursor(0,0);       
  lcd.print("  LPG Value is  "); 

  lcd.setCursor(0,1);
  lcd.print(lpgvalue);

  delay(1500);

  Serial.print(" tempsensorvalue is ");
  Serial.println(tempvalue);

  lcd.setCursor(0,0);       
  lcd.print("  tempsensorvalue is  "); 

  lcd.setCursor(0,1);
  lcd.print(tempvalue);

  delay(1500);

}