top of page

How to Make Remote Door Lock



Circuit:


Download Code click.....


const int irPin = 4;

const int Relay1 = 2;

const int led = 3;


boolean Relay1State = false;


void setup() {

  

  //Serial.begin(115200);

  pinMode(irPin, INPUT);

  pinMode(Relay1, OUTPUT);

  pinMode(led, OUTPUT);

  digitalWrite(Relay1, HIGH);

  

}


void loop() {

  int key = getIrKey();


  if(key == 3563 && 3425 && 3564 && 2343){

    Relay1State = !Relay1State;

    if(Relay1State == true){

      digitalWrite(Relay1, LOW);

      delay(1000);

      digitalWrite(Relay1, HIGH);

      delay(1000);

  }

    else

      digitalWrite(led, HIGH);

      delay(100);

      digitalWrite(led, HIGH);

      delay(100);

      digitalWrite(led, HIGH);

      delay(100);

      digitalWrite(led, HIGH);

      delay(100);

  }


}


int getIrKey(){

  int len = pulseIn(irPin,LOW);

  int key, temp;

  key = 0;

  //Serial.print("len=");

  //Serial.println(len);

  if(len > 5000) {

    for(int i=1;i<=32;i++){

      temp = pulseIn(irPin,HIGH);

      if(temp > 1000)

        key = key + (1<<(i-17));

    }

  }

  if(key < 0 )

    key = -key;

  

  //if(key)

    //Serial.println(key);


    delay(250);

  return key;

}

250 views1 comment

Recent Posts

See All

1 comentário


Nathan Blackburn
Nathan Blackburn
22 de dez. de 2023

I was impressed with the quality of service from Locksmith Myrtle Beach company during the installation of my remote door lock. The technicians were courteous, arrived on time, and worked efficiently. They took the time to walk me through the features of the new lock and ensured I was comfortable using the remote access.

Curtir
bottom of page