#include "Wire.h"
#include "LiquidCrystal.h"
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

void setup()
{
  Wire.begin(2);                // join i2c bus with address #2
  Wire.onReceive(receiveEvent); // register event
  pinMode(9,INPUT);
  pinMode(10,INPUT);
  //pinMode(8,OUTPUT);
  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  lcd.print("SMART House Lock");
}

void loop()
{
    lcd.setCursor(0,1);
    lcd.print("   Enter Code   ");
    delay(4000);
}

void receiveEvent(int howMany)
{
  int port = Wire.read();    // receive byte as an integer
  int value = Wire.read();   // receives the byte with the value
  digitalWrite(port,value);         // sets the pin to the desired value
  if(value==HIGH)
    {
    lcd.setCursor(0,1);
    lcd.print("    Welcome    ");
    delay(5000);
    }
}