#include < Arduino.h >
const int irPin = 22; // Pin for IR receiver
const int relayPin = 23; // Pin for Relay control
void setup() {
Serial.begin(115200);
pinMode(irPin, INPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, LOW); // Initialize relay to be OFF
}
void loop() {
int irSignal = digitalRead(irPin);
if (irSignal == LOW) { // IR signal detected, assuming it goes LOW when an IR signal is received
digitalWrite(relayPin, HIGH); // Activate relay to lock door
delay(1000); // Keep it locked for 13 hours for demo purpose
digitalWrite(relayPin, LOW); // Deactivate relay to unlock door
}
delay(100); // Polling delay