Go Down

Topic: Fingerprint sensor invalid library found (Read 212 times) previous topic - next topic

Claxon

I am trying to use the fingerprint sensor 751 from adafruit along with a arduino uno. I've tried several different codes from Github but each of them leaves me with the error "invalid library found" or "C:\Users\Clayton\Downloads\Fingerprint\Fingerprint.ino:2:26: fatal error: Adafruit_GFX.h: No such file or directory #include <Adafruit_GFX.h>"

Does anyone have any fixes for this.

Claxon

I'm having trouble finding working code for my fingerprint sensor that I can actually download to the uno.  A link to the code would be greatly appreciated. I'm constantly getting "invalid library" or the "file does not exist"

pert

Let's keep it to a single thread instead of breaking the same discussion into two threads, which will just end up wasting our time due to duplicate effort.

http://forum.arduino.cc/index.php?topic=504224

pert

You need to give exact details of what you're doing when you get the "invalid library" error if you want us to help you.

Coding Badly


Claxon


I'm taking the code found from the github site, under adafruit/Adafruit-Fingerprint-Sensor-Library. I changed the file type from a .cpp to .ino to get the arduino software to open the file. Then when I try to download it to the uno I get the below message.

C:\Users\Clayton\Downloads\Adafruit-Fingerprint-Sensor-Library-master\Adafruit-Fingerprint-Sensor-Library-master\Adafruit_Fingerprint\Adafruit_Fingerprint.ino:17:34: fatal error: Adafruit_Fingerprint.h: No such file or directory

 #include "Adafruit_Fingerprint.h"

                                  ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

pert

I changed the file type from a .cpp to .ino to get the arduino software to open the file.
That will allow you to open the file but it's not going to compile because that's not a sketch, it's a library. Libraries contain code that you can access from your sketch by #include-ing the library header file but they are not complete programs in themselves.

In order to use the Adafruit Fingerprint Sensor Library you first need to install it:
  • Sketch > Include Library > Manage Libraries
  • Wait for the download to finish.
  • In the "Filter your search..." box, type "Adafruit Fingerprint Sensor Library"
  • Click on the Adafruit Fingerprint Sensor Library entry.
  • Click "Install".
  • Wait for the installation to finish.
  • Click "Close".


After doing this you will find example sketches under File > Examples > Adafruit Fingerprint Sensor Library that demonstrate how you can use the library in your project.

Claxon

Thanks that worked, I've got it upload to the board.

My new problem is that the serial monitor prints out the following:

fingertest
Found fingerprint sensor!
Type in the ID # you want to save this finger as...

But when I go to type and send in a number for the ID, nothing else happens. I thought the serial monitor was supposed to update and provide more instructions going forward. Any thoughts.



Claxon

Another problem I'm having is that the red led in the fingerprint sensor will not turn on when its powered, yet the software sfgDemo is reading that there is a sensor connected.

PaulS

Quote
I thought the serial monitor was supposed to update and provide more instructions going forward. Any thoughts.
So, some code that only you can see does not do what you expect. What is actually does is a mystery, because we can't see the code and you didn't describe what it actually does. It's hard to get from point A to point B when you have no idea where point A is.
The art of getting good answers lies in asking good questions.

Claxon

#10
Oct 12, 2017, 07:31 pm Last Edit: Oct 13, 2017, 05:11 am by Coding Badly
This is the code I'm using for the fingerprint sensor and the code that is providing me the problems with the serial print.


Code: [Select]

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

uint8_t getFingerprintEnroll(uint8_t id);


// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino  (WHITE wire)
SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup() 
{
  Serial.begin(9600);
  Serial.println("fingertest");

  // 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);
  }
}

void loop()                     // run over and over again
{
  Serial.println("Type in the ID # you want to save this finger as...");
  uint8_t id = 0;
  while (true) {
    while (! Serial.available());
    char c = Serial.read();
    if (! isdigit(c)) break;
    id *= 10;
    id += c - '0';
  }
  Serial.print("Enrolling ID #");
  Serial.println(id);
 
  while (!  getFingerprintEnroll(id) );
}

uint8_t getFingerprintEnroll(uint8_t id) {
  uint8_t p = -1;
  Serial.println("Waiting for valid finger to enroll");
  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.println(".");
      break;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      break;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging error");
      break;
    default:
      Serial.println("Unknown error");
      break;
    }
  }

  // OK success!

  p = finger.image2Tz(1);
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }
 
  Serial.println("Remove finger");
  delay(2000);
  p = 0;
  while (p != FINGERPRINT_NOFINGER) {
    p = finger.getImage();
  }

  p = -1;
  Serial.println("Place same finger again");
  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.print(".");
      break;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      break;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging error");
      break;
    default:
      Serial.println("Unknown error");
      break;
    }
  }

  // OK success!

  p = finger.image2Tz(2);
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }
 
 
  // OK converted!
  p = finger.createModel();
  if (p == FINGERPRINT_OK) {
    Serial.println("Prints matched!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_ENROLLMISMATCH) {
    Serial.println("Fingerprints did not match");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }   
 
  p = finger.storeModel(id);
  if (p == FINGERPRINT_OK) {
    Serial.println("Stored!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_BADLOCATION) {
    Serial.println("Could not store in that location");
    return p;
  } else if (p == FINGERPRINT_FLASHERR) {
    Serial.println("Error writing to flash");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }   
}


Moderator edit: [code] [/code] tags added.

Go Up