#define SENSOR_PIN 2
#define LED_PIN 13
#define BUZZER_PIN 12
void setup() {
pinMode(SENSOR_PIN, INPUT_PULLUP);
pinMode(LED_PIN, OUTPUT);
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600); // initialize the serial monitor
}
void loop() {
int sensorValue = digitalRead(SENSOR_PIN);
if(sensorValue == LOW) { // If the "fingerprint" is recognized
digitalWrite(LED_PIN, HIGH); // Unlock the "door"
digitalWrite(BUZZER_PIN, HIGH); // Sound the buzzer
Serial.println("Door Unlocked");
delay(5000); // Keep the "door" unlocked for 5 seconds
digitalWrite(LED_PIN, LOW); // Lock the "door" again
digitalWrite(BUZZER_PIN, LOW); // Turn off the buzzer
Serial.println("Door Locked");
}
delay(1000); // Wait for 1 second
}