Commit 0008103f authored by lui.bingham's avatar lui.bingham

Solenoid Fingerprint Unlock Code Upload

parent c476fc27
#include <Adafruit_Fingerprint.h>
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
#define RELAY_PIN 7
#define ACCESS_DELAY 5000 // Unlock for 5 seconds.
void setup()
{
// Sets the data rate for the fingerprint serial
finger.begin(57600);
delay(5);
if (finger.verifyPassword())
{
}
else
{
while (1) { delay(1); }
}
pinMode(RELAY_PIN, OUTPUT);
digitalWrite(RELAY_PIN, HIGH); //Keep the door locked initially.
}
void loop()
{
if ( getFingerPrint() != -1)
{
digitalWrite(RELAY_PIN, LOW); // Unlock the Solenoid
delay(ACCESS_DELAY); // Wait 5 seconds
digitalWrite(RELAY_PIN, HIGH); // Lock the Solenoid
}
delay(50);
}
int getFingerPrint()
{
int p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;
p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;
p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;
return finger.fingerID; // Matching fingerprint found!
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment