Finger print sensor error

I have downloaded the code from

While verifying the code i recive these many errors.
please someone suggest me the solution.

fingerprint:26: error: ‘Adafruit_Fingerprint’ does not name a type
fingerprint.ino: In function ‘void setup()’:
fingerprint:39: error: ‘finger’ was not declared in this scope
fingerprint.ino: In function ‘uint8_t getFingerprintID()’:
fingerprint:57: error: ‘finger’ was not declared in this scope
fingerprint:59: error: ‘FINGERPRINT_OK’ was not declared in this scope
fingerprint:62: error: ‘FINGERPRINT_NOFINGER’ was not declared in this scope
fingerprint:65: error: ‘FINGERPRINT_PACKETRECIEVEERR’ was not declared in this scope
fingerprint:68: error: ‘FINGERPRINT_IMAGEFAIL’ was not declared in this scope
fingerprint:80: error: ‘FINGERPRINT_OK’ was not declared in this scope
fingerprint:83: error: ‘FINGERPRINT_IMAGEMESS’ was not declared in this scope
fingerprint:86: error: ‘FINGERPRINT_PACKETRECIEVEERR’ was not declared in this scope
fingerprint:89: error: ‘FINGERPRINT_FEATUREFAIL’ was not declared in this scope
fingerprint:92: error: ‘FINGERPRINT_INVALIDIMAGE’ was not declared in this scope
fingerprint:102: error: ‘FINGERPRINT_OK’ was not declared in this scope
fingerprint:104: error: ‘FINGERPRINT_PACKETRECIEVEERR’ was not declared in this scope
fingerprint:107: error: ‘FINGERPRINT_NOTFOUND’ was not declared in this scope
fingerprint.ino: In function ‘int getFingerprintIDez()’:
fingerprint:122: error: ‘finger’ was not declared in this scope
fingerprint:123: error: ‘FINGERPRINT_OK’ was not declared in this scope
fingerprint:126: error: ‘FINGERPRINT_OK’ was not declared in this scope
fingerprint:129: error: ‘FINGERPRINT_OK’ was not declared in this scope
enroll.ino: At global scope:
enroll:28: error: redefinition of ‘SoftwareSerial mySerial’
fingerprint:25: error: ‘SoftwareSerial mySerial’ previously declared here
enroll:29: error: ‘Adafruit_Fingerprint’ does not name a type
enroll.ino: In function ‘void setup()’:
enroll:35: error: redefinition of ‘void setup()’
fingerprint:31: error: ‘void setup()’ previously defined here
enroll:44: error: ‘finger’ was not declared in this scope
enroll.ino: In function ‘void loop()’:
enroll:70: error: redefinition of ‘void loop()’
fingerprint:50: error: ‘void loop()’ previously defined here
enroll.ino: In function ‘uint8_t getFingerprintEnroll()’:
enroll:84: error: ‘FINGERPRINT_OK’ was not declared in this scope
enroll:85: error: ‘finger’ was not declared in this scope
enroll:87: error: ‘FINGERPRINT_OK’ cannot appear in a constant-expression
enroll:90: error: ‘FINGERPRINT_NOFINGER’ was not declared in this scope
enroll:93: error: ‘FINGERPRINT_PACKETRECIEVEERR’ was not declared in this scope
enroll:96: error: ‘FINGERPRINT_IMAGEFAIL’ was not declared in this scope
enroll:107: error: ‘finger’ was not declared in this scope
enroll:109: error: ‘FINGERPRINT_OK’ was not declared in this scope
enroll:112: error: ‘FINGERPRINT_IMAGEMESS’ was not declared in this scope
enroll:115: error: ‘FINGERPRINT_PACKETRECIEVEERR’ was not declared in this scope
enroll:118: error: ‘FINGERPRINT_FEATUREFAIL’ was not declared in this scope
enroll:121: error: ‘FINGERPRINT_INVALIDIMAGE’ was not declared in this scope
enroll:132: error: ‘FINGERPRINT_NOFINGER’ was not declared in this scope
enroll:138: error: ‘FINGERPRINT_OK’ was not declared in this scope
enroll:141: error: ‘FINGERPRINT_OK’ cannot appear in a constant-expression
enroll:144: error: ‘FINGERPRINT_NOFINGER’ was not declared in this scope
enroll:147: error: ‘FINGERPRINT_PACKETRECIEVEERR’ was not declared in this scope
enroll:150: error: ‘FINGERPRINT_IMAGEFAIL’ was not declared in this scope
enroll:163: error: ‘FINGERPRINT_OK’ was not declared in this scope
enroll:166: error: ‘FINGERPRINT_IMAGEMESS’ was not declared in this scope
enroll:169: error: ‘FINGERPRINT_PACKETRECIEVEERR’ was not declared in this scope
enroll:172: error: ‘FINGERPRINT_FEATUREFAIL’ was not declared in this scope
enroll:175: error: ‘FINGERPRINT_INVALIDIMAGE’ was not declared in this scope
enroll:187: error: ‘FINGERPRINT_OK’ was not declared in this scope
enroll:189: error: ‘FINGERPRINT_PACKETRECIEVEERR’ was not declared in this scope
enroll:192: error: ‘FINGERPRINT_ENROLLMISMATCH’ was not declared in this scope
enroll:202: error: ‘FINGERPRINT_OK’ was not declared in this scope
enroll:204: error: ‘FINGERPRINT_PACKETRECIEVEERR’ was not declared in this scope
enroll:207: error: ‘FINGERPRINT_BADLOCATION’ was not declared in this scope
enroll:210: error: ‘FINGERPRINT_FLASHERR’ was not declared in this scope

the code is:
/***************************************************
This is an example sketch for our optical Fingerprint sensor

Designed specifically to work with the Adafruit BMP085 Breakout
----> http://www.adafruit.com/products/751

These displays use TTL Serial to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

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

int getFingerprintIDez();

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

// On Leonardo/Micro or others with hardware serial, use those! #0 is green wire, #1 is white
//Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial1);

void setup()
{
while (!Serial); // For Yun/Leo/Micro/Zero/…

Serial.begin(9600);
Serial.println(“Adafruit finger detect test”);

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

uint8_t getFingerprintID() {
uint8_t p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println(“Image taken”);
break;
case FINGERPRINT_NOFINGER:
Serial.println(“No finger detected”);
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println(“Communication error”);
return p;
case FINGERPRINT_IMAGEFAIL:
Serial.println(“Imaging error”);
return p;
default:
Serial.println(“Unknown error”);
return p;
}

// OK success!

p = finger.image2Tz();
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.fingerFastSearch();
if (p == FINGERPRINT_OK) {
Serial.println(“Found a print match!”);
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println(“Communication error”);
return p;
} else if (p == FINGERPRINT_NOTFOUND) {
Serial.println(“Did not find a match”);
return p;
} else {
Serial.println(“Unknown error”);
return p;
}

// found a match!
Serial.print(“Found ID #”); Serial.print(finger.fingerID);
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!
Serial.print(“Found ID #”); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}

fingerprint.ino (3.76 KB)

Have you installed the library?
If not, in the IDE,
Select Sketch - Include Library - Manage Libraries
Search for "adafruit fingerprint"
Click on the result.
Click on the Install button.

Could we simulate the same code on a virtual simulator like proteus ????

fingerprint:26: error: 'Adafruit_Fingerprint' does not name a type
fingerprint.ino: In function 'void setup()':
fingerprint:39: error: 'finger' was not declared in this scope

This probably means that the Adafruit_Fingerprint library was not installed correctly. All of the subsequent errors are also caused by the problem with the library. Time to re-install the library. If you have another library with the same or similar name you should get rid of it. If there is another Adafruit_Fingerprint.h file anywhere outside the library you should get rid of it.