Stap 6: Instellen van de vingerafdruk-Scanner
Voor de communicatie met de FPS, ik zal het gebruiken van deze bibliotheek Arduino door Josh Hawley (directe download voor de bibliotheek hier).
Om te controleren of de communicatie met uw vingerafdruk-scanner werkt, zou ik dit voorbeeld knipperen uploaden.
De vingerafdruk-scanner heeft zijn eigen geheugen voor het opslaan van de vingerafdrukgegevens. Dus, nadat u hebt gecontroleerd dat de FOD werkt, uploaden van de schets van dit voorbeeld als u wilt uw vingerafdruk toevoegen aan de database onder id #0. De seriële console te openen en volg de instructies.
Code:
Knipperen in het volgende voorbeeld:
/* Library example for controlling the GT-511C3 Finger Print Scanner (FPS) Created by Josh Hawley, July 23rd 2013 Licensed for non-commercial use, must include this license message basically, Feel free to hack away at it, but just give me credit for my work =) TLDR; Wil Wheaton's Law This simple sketch turns the LED on and off similar to the Arduino blink sketch. It is used to show that communications are working. */ #include "FPS_GT511C3.h" #include "SoftwareSerial.h" //Hardware setup - FPS connected to: //digital pin 10(arduino rx, fps tx) //digital pin 11(arduino tx - 560ohm resistor fps tx - 1000ohm resistor - ground) //this brings the 5v tx line down to about 3.2v so we dont fry our fps FPS_GT511C3 fps(10, 11); void setup(){ Serial.begin(9600); fps.UseSerialDebug = true; // so you can see the messages in the serial debug screen fps.Open(); } void loop(){ // FPS Blink LED Test fps.SetLED(true); // turn on the LED inside the fps delay(1000); fps.SetLED(false);// turn off the LED inside the fps delay(1000); }
Inschrijven in het volgende voorbeeld:
/* FPS_Enroll.ino - Library example for controlling the GT-511C3 Finger Print Scanner (FPS) Created by Josh Hawley, July 23rd 2013 Licensed for non-commercial use, must include this license message basically, Feel free to hack away at it, but just give me credit for my work =) TLDR; Wil Wheaton's Law */ #include "FPS_GT511C3.h" #include "SoftwareSerial.h" //Hardware setup - FPS connected to: //digital pin 10(arduino rx, fps tx) //digital pin 11(arduino tx - 560ohm resistor fps tx - 1000ohm resistor - ground) //this brings the 5v tx line down to about 3.2v so we dont fry our fps FPS_GT511C3 fps(10, 11); void setup(){ Serial.begin(9600); delay(100); fps.Open(); fps.SetLED(true); Enroll(); } void Enroll(){ // Enroll test // find open enroll id int enrollid = 0; fps.EnrollStart(enrollid); // enroll Serial.print("Press finger to Enroll #"); Serial.println(enrollid); while(fps.IsPressFinger() == false) delay(100); bool bret = fps.CaptureFinger(true); int iret = 0; if (bret != false) { Serial.println("Remove finger"); fps.Enroll1(); while(fps.IsPressFinger() == true) delay(100); Serial.println("Press same finger again"); while(fps.IsPressFinger() == false) delay(100); bret = fps.CaptureFinger(true); if (bret != false) { Serial.println("Remove finger"); fps.Enroll2(); while(fps.IsPressFinger() == true) delay(100); 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) { Serial.println("Enrolling Successfull"); } else { 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"); } void loop(){ delay(100000); }