How to use different fingers for different relays

suppose i have fingerprint sensor and i put thumb relay 1 on so i want if i put index finger relay 2 will be on so how can we define fingers with finger id to arduino

Suppose you start here

Welcome to the forum

Your topic was MOVED to its current forum category as it is more suitable than the original

Hi, @Aamir_usman

Can you please tell us your electronics, programming, arduino, hardware experience?

What hardware do you have?
Fingerprint Sensor.
Model Arduino.

Thanks.. Tom... :+1: :smiley: :coffee: :australia:

There has to be an assumption that your fingerprint library provides a unique ‘index’ for each recognised input against the registered fingerprints - or an invalid response if not recognised.

With that index, you can choose what to do… or, if the reader simply says ‘good’ or ‘bad’, you’re out of luck unless you can dig deeper in the library/reader driver.

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
{
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
delay(100);
Serial.println("fingertest");

tone(9, 1000);
delay(400);
noTone(9);

pinMode(8, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
digitalWrite(8, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
delay(1000);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
delay(1000);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
tone(9, 2500);
delay(400);
noTone(9);

// set the data rate for the sensor serial port
finger.begin(57600);

if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1) {
delay(1);
}
}

finger.getTemplateCount();
Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
Serial.println("Waiting for valid finger...");
}

void loop() // run over and over again

{
getFingerprintIDez();
delay(50); //don't ned to run this at full speed.
}

// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
uint8_t 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;

// found a match!

{
digitalWrite(8, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
delay(1000);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
tone(9, 500);
delay(100);
tone(9, 1000);
delay(100);
tone(9, 1500);
delay(100);
tone(9, 2000);
delay(100);
tone(9, 2500);
delay(300);
noTone(9);

Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);

}
}

i want to use multi fingers for multi relay pins
e.g
thumb turn on relay 1
index finger turn on relay 2
middle finger turn on relay 3

@Aamir_usman
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

i dont want to use finger.verifyPassword
i want to use fingerprint id e/g #1 #2

Hi,
Before you repost your code press [ CRTL ] [ T ] in the IDE, it will auto format your code so it has idents to make it easier to read.
To add code please click this link;

Thanks.. Tom... :+1: :smiley: :coffee: :australia:

Add:

  if (finger.confidence > MinimumConfidenceLimit)
  {
    if (finger.fingerID == LeftThumbID)
      digitalWrite(LeftThumbRelay, 0); // Turn on relay
    if (finger.fingerID == LeftIndexFingerID)
      digitalWrite(LeftIndexFingerRelay, 0); // Turn on relay
.
.
.
  }

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