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
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
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
finger.begin(57600);
// Wait for stabilisation
delay(100);
if (finger.verifyPassword()) {
Serial.println("OK!");
} else {
Serial.println("FAILED");
}

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

Serial.println(F("Ready..."));
}

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."));
return;
}

// 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(finger.fingerID);
Serial.print(F(", confidence level:"));
Serial.println(finger.confidence);

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

if(Serial.print(finger.fingerID==1)){
Serial.print(F("opening door1 ----->>>>"));
Serial.println();
digitalWrite( 4, HIGH);
digitalWrite( 8, HIGH);

delay(1000);
digitalWrite(4, LOW);
digitalWrite( 8,LOW);
delay(500);
}

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

}

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:

  Serial.print(finger.fingerID);

  if(finger.fingerID==1) {

HOLY COW!!!!!
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.