Fingerprints trigger different tasks

How can I get the Arduino and it's fingerprint reader to do different tasks for different recognized fingers? E.g.: person A's finger only can open main door. Person B's finger can only trigger side door.
Thx a lot for helping!!!

Usually, a fingerprint reader will give you an id to identify the person who used it. You can use that Id to decide what task to do.

Thank you kindly for your response. I did try what you said but failed in coding. I would appreciate a code sample

There are probably code examples that came with whatever library you are using for the fingerprint reader.

For example: Adafruit_Fingerprint_Sensor_Library has an example named "fingerprint" which will display the fingerprint ID.

Thx for replying. I did use that, I even get the ID displayed and accuracy of the recognition. But I cant get the code to work to use that ID for execution of pin outputs. I keep looking over a week online for code examples, but there are none. Pls help!

Post your best attempt.

When one of the two fingers get recognized both happens: Pin 4 and 8 and then 7 and 13 get toggled.

Correct would be one finger toggles 4 and 8, the other finger 7 and 13.
Thanks for help!!!!

void setup() {
// Start the serial connection to enable debug output to be displayed on the Serial Monitor
int ledPin = 4;
pinMode(ledPin, OUTPUT);

int ledPin2 = 7;
pinMode(ledPin2, OUTPUT);

int ledPin3 = 8;
pinMode(ledPin3, OUTPUT);

int ledPin4 = 12;
pinMode(ledPin4, OUTPUT);

Serial.print(F("Connecting to fingerprint sensor..."));
// Begin serial communication with the fingerprint sensor
// Wait for stabilisation
if (finger.verifyPassword()) {
} else {

// Retrieve the count of registered fingerprints
Serial.print(F("Sensor database contains "));
Serial.println(F(" fingerprint templates"));


void loop() {
// Step One - if finger is detected, attempt to take a photo
int status = finger.getImage();
if(status == FINGERPRINT_OK) {
Serial.print(F("Finger detected... "));
else { return; }

// Step Two - attempt to extract features from the image
status = finger.image2Tz();
if(status == FINGERPRINT_OK) {
Serial.print(F("Features extracted... "));
else {
Serial.println(F("Could not extract features."));

// Step Three - search for matching features in the database of registered fingerprints
status = finger.fingerFastSearch();
if(status == FINGERPRINT_OK) {
Serial.print(F("Match found! ID:"));
Serial.print(F(", confidence level:"));

else {
Serial.println(F("No match found."));
Serial.print(F("good luck next time ----->>>>"));
digitalWrite( 12, HIGH);
digitalWrite( 12, LOW);

Serial.print(F("opening door1 ----->>>>"));
digitalWrite( 4, HIGH);
digitalWrite( 8, HIGH);

digitalWrite(4, LOW);
digitalWrite( 8,LOW);

if(Serial.print(finger.fingerID == 2)){
Serial.print(F("opening door2 ----->>>>"));
digitalWrite( 7, HIGH);
digitalWrite( 13, HIGH);
digitalWrite(7, LOW);
digitalWrite( 13, LOW);


Serial.print() returns the number of characters printed. This will likely be a number other than 0 so the 'if' statement considers that 'true'.

What you PROBABLY wanted to do was:


  if(finger.fingerID==1) {

Thank you so much!!!! I got it to work. Super great!
And at the end, I look at the advide and think: sure, why didn't see that solution myself.....
I spent a week on this...OMG.
Hey John, if you are in southern California I may wanna invite you for a beer! Thanks again!!!

Glad I was able to help.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.