how to replace finger.fingerID to name?

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

the result in serial monitor "Found ID# 20 with confidence of 287"

i want the number to be my name...

for example i want it to be "Found ID# maria with confidence of 287"

what should i do?

thx :slight_smile:

Make a list of the ID numbers and a list of matching names. Search the list of ID numbers for the ID. Display the matching entry in the list of names.

johnwasser:
Make a list of the ID numbers and a list of matching names. Search the list of ID numbers for the ID. Display the matching entry in the list of names.

how to do that? sorry not so familiar with the codes..

how to do that?

Global variables:

int ownerIDs[10] = {20 /* Add other IDs here, separated by commas */ };
char *ownerNames[10] = {"maria" /* Add other names here, separated by commas */ };

In place of the code snippet you showed:

   bool found = false;
   for(byte n=0; n<10; n++)
   {
       if(finger.fingerID == ownerIDs[n])
       {
           Serial.print("Fingerprint belongs to ");
           Serial.print(ownerNames[n]);
           Serial.print(" with confidence of ");
           Serial.println(finger.confidence);
           found = true;
       }
   }
   if(!found)
      Serial.println("Fingerprint owner unknown.");

PaulS:
Global variables:

int ownerIDs[10] = {20 /* Add other IDs here, separated by commas */ };

char ownerNames[10] = {"maria" / Add other names here, separated by commas */ };





In place of the code snippet you showed:


bool found = false;
  for(byte n=0; n<10; n++)
  {
      if(finger.fingerID == ownerIDs[n])
      {
          Serial.print("Fingerprint belongs to ");
          Serial.print(ownerNames[n]);
          Serial.print(" with confidence of ");
          Serial.println(finger.confidence);
          found = true;
      }
  }
  if(!found)
      Serial.println("Fingerprint owner unknown.");

hi paul thanks for your response :slight_smile:
i input your codes... but still not showing the name..

take time to analyze my code..hope you can help me

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

const int pinServo      = 6;                            // servo pin
const int angleServo    = 60;                           // Rotation angle

int getFingerprintIDez();
int ownerIDs[10] = {22};
char *ownerNames[10] = {"maria zussete"};
SoftwareSerial mySerial(2, 3);
SoftwareSerial SIM900(7, 8);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
Servo myservo;

void open_close_door()
{
    myservo.attach(pinServo);
    for(int i=20; i<angleServo; i++)
    {
        myservo.write(i);
        delay(5);
    }

    delay(2000);

    for(int i=(angleServo-1); i>=20; i--)
    {
        myservo.write(i);
        delay(5);
    }
    myservo.detach();
}

void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
}

void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+639988616678\"");                                     // recipient's mobile number, in international format
  delay(100);
  SIM900.print("ACCESS GRANTED!");
  SIM900.print("Welcome Home ");
  SIM900.println(finger.fingerID);
  SIM900.print("This is a text message from an Arduino Uno.");        // message to send
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100); 
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  SIM900power();                                   // turn off module
}

void intruderSMS()
{
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+639988616678\"");                                     // recipient's mobile number, in international format
  delay(100);
  SIM900.println("INTRUDER ALERT!! This is a text message from an Arduino Uno.");        // message to send
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100); 
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  SIM900power();                                   // turn off module
}
void setup()

{
    SIM900.begin(19200);
    SIM900power();
    delay(20000);
    Serial.begin(9600);
    finger.begin(57600);
    delay(500);
    Serial.println("Scan Fingerprint");
}
void loop() // run over and over again
{

getFingerprintID();

delay(100);

}

uint8_t getFingerprintID()

{ uint8_t p = finger.getImage();

switch (p)

{

case FINGERPRINT_OK:

Serial.println(" Image taken... ");

delay(1000);

break;

case FINGERPRINT_NOFINGER:

return p;

case FINGERPRINT_PACKETRECIEVEERR:

return p;

case FINGERPRINT_IMAGEFAIL:

return p;

default:

return p; }

// OK success!

p = finger.image2Tz();

switch (p) {

case FINGERPRINT_OK:

break;

case FINGERPRINT_IMAGEMESS:

return p;

case FINGERPRINT_PACKETRECIEVEERR:

return p;

case FINGERPRINT_FEATUREFAIL:

return p;

case FINGERPRINT_INVALIDIMAGE:

return p;

default:

return p; }

// OK converted!

p = finger.fingerFastSearch();

if (p == FINGERPRINT_OK)

{
sendSMS();
open_close_door();
Serial.println(" Found match! ");

}

else if(p == FINGERPRINT_NOTFOUND)

{
intruderSMS();
Serial.print(" Did not match! ");

Serial.print("Intruder Alert!!");

return p;

}

else

{ return p; }

// IF FOUND A MATCH............
    Serial.print("Fingerprint belongs to ");
    Serial.print(ownerNames[10]);
    Serial.print(" with confidence of ");
    Serial.println(finger.confidence);
}
// 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!
bool found = false;
for (byte n=0; n<10; n++)
{
  if (finger.fingerID == ownerIDs[10])
{
    Serial.print("Fingerprint belongs to ");
    Serial.print(ownerNames[n]);
    Serial.print(" with confidence of ");
    Serial.println(finger.confidence);
    found = true;
return finger.fingerID;
}
  }
   if(!found)
      Serial.println("Fingerprint owner unknown.");
}

the result in serial monitor "Found ID# 20 with confidence of 287"

So why did you put 22 in the table?

PaulS:
So why did you put 22 in the table?

22 is the registered fingerprint of mine... and it still not showing...

SoftwareSerial mySerial(2, 3);
SoftwareSerial SIM900(7, 8);

This project is doomed to failure.

    Serial.print(ownerNames[10]);

Printing a value beyond the end of the array is stupid. Array indices start at 0.

What happened to the loop that compared the ID that was read to the elements of the ID array?

PaulS:

SoftwareSerial mySerial(2, 3);

SoftwareSerial SIM900(7, 8);



This project is doomed to failure.

something wrong with it? coz i want to receive a sms when someone logs on my room :slight_smile:

PaulS:
Printing a value beyond the end of the array is stupid. Array indices start at 0.

sorry kinda noob in programming...just want to try this arduino...it impress me and motivate me to create this project..

something wrong with it?

Only one instance of SoftwareSerial can listen at a time. If you are listening to the mySerial (otherwise known as a fingerprintReader), you are not listening to the modem. Any incoming phone calls or text messages will hit the bit bucket.

If you are listening to the modem, you can forget about fingerprints being recognized.

You need a Mega or similar Arduino with 4 hardware serial ports.

sorry kinda noob in programming...just want to try this arduino...it impress me and motivate me to create this project..

So why did you butcher code that appears to work? If it doesn't, figure out why. Don't just delete stuff for the hell of it.

Put the code back like in reply #3 (but using the value 22, which you now seem to think is your ID).

If that does not produce the output you expect, add some Serial.print() statements to figure out why not.

Hi paul!

i had my project work!! :slight_smile:
thank you so much for your help!! <3

one more thing ;p

p = finger.fingerFastSearch();

if (p == FINGERPRINT_OK)

{
sendSMS();
open_close_door();
Serial.println(" Found match! ");

}

else if(p == FINGERPRINT_NOTFOUND)

{
intruderSMS();
Serial.print(" Did not match! ");

Serial.print("Intruder Alert!!");

return p;

}

in the if not found statement...how can i have it say the "Intruder Alert" message after 3 scan attempts.

coz i dont want it to be, whenever my enrolled fingerprint fails will always notify me intruder alert! hahah

in the if not found statement...how can i have it say the "Intruder Alert" message after 3 scan attempts.

You have to count the failed attempts (resetting that count to 0 when there is a success).

halo guys, I'm working with fingerprint and, it's working with the code that I found in internet, and I saw this forum talking about changing the ID# into the name
it's working as well,
but I can't adding another ID# and name, it's only display one name with many ID# and name in Global variable
please help me to solve it
thanks for your time

but I can't adding another ID# and name

Writing them on post-it notes rarely works. You actually have to modify the code. The code that you didn't bother posting.

here's my code, please help me to analyze the code :slight_smile:
I'm really a noob with coding

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

int getFingerprintIDez();

SoftwareSerial mySerial(2, 3);
LiquidCrystal lcd(9, 8, 7, 6, 5, 4); // initialize the library with the numbers of the interface pins
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
 int ownerIDs[10] = {7, 6}; 
 char *ownerNames[10] = {"John", "McBride"};
              


void setup()

{ 
Serial.begin(9600); // initialize the serial communications:
lcd.begin(16,2); l
cd.setCursor(0,0); 
lcd.print("Scan your finger");

pinMode(13,OUTPUT);
pinMode(11, OUTPUT);
finger.begin(57600);

}
void loop() 
{
getFingerprintID();
delay(100);
digitalWrite (13,HIGH);
}
uint8_t getFingerprintID()
{ 
uint8_t p = finger.getImage();
switch (p)

{

case FINGERPRINT_OK:

lcd.clear();
lcd.print(" Image taken... ");
delay(1000);
break;
case FINGERPRINT_NOFINGER:
return p;
case FINGERPRINT_PACKETRECIEVEERR:
return p;
case FINGERPRINT_IMAGEFAIL:
return p;
default:
return p; }

// OK success!

p = finger.image2Tz();
switch (p) {
case FINGERPRINT_OK:
break;
case FINGERPRINT_IMAGEMESS:
return p;
case FINGERPRINT_PACKETRECIEVEERR:
return p;
case FINGERPRINT_FEATUREFAIL:
return p;
case FINGERPRINT_INVALIDIMAGE:
return p;
default:
return p; }
// OK converted!

p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK)
{
lcd.clear();
lcd.print(" Found match! ");
digitalWrite(11, HIGH);
delay(1000);
digitalWrite(11,LOW); // turn on green LED to indicate match
}
else if(p == FINGERPRINT_NOTFOUND)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" Did not match! ");
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" scan finger! ");
return p;
}
else
{ return p; }

// IF FOUND A MATCH............

lcd.clear();
lcd.setCursor(0,0);
lcd.print("Belongs To");
lcd.print(ownerNames[10]);
lcd.setCursor(0,1);
lcd.print("confidence ");
lcd.print(finger.confidence);
}
// 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!

bool found = false;
for (byte n=0; n<10; n++)
{
  if (finger.fingerID == ownerIDs[10])
{
    Serial.print("Fingerprint belongs to ");
    Serial.print(ownerNames[n]);
    Serial.print(" with confidence of ");
    Serial.println(finger.confidence);
    found = true;
return finger.fingerID;
}
  }
   if(!found)
      Serial.println("Fingerprint owner unknown.");
}