Last active
August 29, 2015 14:07
-
-
Save vdemay/a966b71371372e95e4e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FPS_GT511C3.h" | |
#include "SoftwareSerial.h" | |
//FPS connected to pin 4 and 5 - see previous schemas | |
FPS_GT511C3 fps(4, 5); | |
void setup() | |
{ | |
Serial.begin(9600); | |
//display messages on the classical serial teminal - DEBUG | |
fps.UseSerialDebug = true; | |
fps.Open(); | |
//call Enroll to add fingerprint | |
enroll(); | |
} | |
void enroll() | |
{ | |
// get the first available id for new finger print | |
int enrollid = 0; | |
bool usedid = true; | |
while (usedid == true) | |
{ | |
usedid = fps.CheckEnrolled(enrollid); | |
if (usedid==true) enrollid++; | |
} | |
//enrollment start here with the first free id | |
fps.EnrollStart(enrollid); | |
Serial.print("Press finger to Enroll #"); | |
Serial.println(enrollid); | |
// ***** FIRST MEASURE ***** | |
// wait for finger press | |
while(fps.IsPressFinger() == false) delay(100); | |
bool bret = fps.CaptureFinger(true); | |
int iret = 0; | |
if (bret != false) | |
{ | |
//has a finger print captured | |
Serial.println("Remove finger"); | |
// Enroll step 1 | |
fps.Enroll1(); | |
//wait for finger removed | |
while(fps.IsPressFinger() == true) delay(100); | |
// ***** SECOND MEASURE ***** | |
// Now we need to check the finger print | |
// wait for finger press | |
Serial.println("Press same finger again"); | |
while(fps.IsPressFinger() == false) delay(100); | |
bret = fps.CaptureFinger(true); | |
if (bret != false) | |
{ | |
Serial.println("Remove finger"); | |
//enroll step 2 | |
fps.Enroll2(); | |
//wait for finger removed | |
while(fps.IsPressFinger() == true) delay(100); | |
// ***** THIRD MEASURE ***** | |
//Check Again the finger print | |
Serial.println("Press same finger yet again"); | |
while(fps.IsPressFinger() == false) delay(100); | |
bret = fps.CaptureFinger(true); | |
if (bret != false) | |
{ | |
Serial.println("Remove finger"); | |
iret = fps.Enroll3(); | |
if (iret == 0) | |
{ | |
//*** SUCCESS third measure are the same -> NOW finger print is stored | |
Serial.println("Enrolling Successfull"); | |
} | |
else | |
{ | |
//*** FAIL For some reason -> NOTHING STORED | |
Serial.print("Enrolling Failed with error code:"); | |
Serial.println(iret); | |
} | |
} | |
else Serial.println("Failed to capture third finger"); | |
} | |
else Serial.println("Failed to capture second finger"); | |
} | |
else Serial.println("Failed to capture first finger"); | |
} | |
//loop is useless here | |
void loop() | |
{ | |
delay(100000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FPS_GT511C3.h" | |
#include "SoftwareSerial.h" | |
//FPS connected to pin 4 and 5 - see previous schemas | |
FPS_GT511C3 fps(4, 5); | |
void setup() | |
{ | |
Serial.begin(9600); | |
//display messages on the classical serial teminal - DEBUG | |
fps.UseSerialDebug = true; | |
fps.Open(); | |
} | |
void loop() | |
{ | |
//blink the led | |
fps.SetLED(true); | |
delay(1000); | |
fps.SetLED(false); | |
delay(1000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FPS_GT511C3.h" | |
#include "SoftwareSerial.h" | |
//FPS connected to pin 4 and 5 - see previous schemas | |
FPS_GT511C3 fps(4, 5); | |
void setup() | |
{ | |
Serial.begin(9600); | |
delay(100); | |
fps.Open(); | |
fps.SetLED(true); | |
} | |
void loop() | |
{ | |
// if a finger is on the sensor | |
if (fps.IsPressFinger()) | |
{ | |
//capture the finger print | |
fps.CaptureFinger(false); | |
//get the id | |
int id = fps.Identify1_N(); | |
//maximun finger print stored in 200. | |
//Id > 200 is a not recognized one | |
if (id <200) | |
{ | |
//finger print recognized: display the id | |
Serial.print("Verified ID:"); | |
Serial.println(id); | |
// ... | |
// add you code here for the condition access allowed | |
// ... | |
} | |
else | |
{ | |
//finger print not recognized | |
Serial.println("Finger not found"); | |
// ... | |
// add you code here for the condition access disallowed | |
// ... | |
} | |
} | |
else | |
{ | |
// wait for finger | |
Serial.println("Please press finger"); | |
} | |
delay(100); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FPS_GT511C3.h" | |
#include "SoftwareSerial.h" | |
//FPS connected to pin 4 and 5 - see previous schemas | |
FPS_GT511C3 fps(4, 5); | |
void setup() | |
{ | |
Serial.begin(9600); | |
delay(100); | |
fps.Open(); | |
//Delete all stored finger print | |
fps.DeleteAll(); | |
//if you want to remove a given id use: | |
// fps.DeleteId(id_to_remove) | |
} | |
void loop() | |
{ | |
delay(10000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment