Skip to content

Commit

Permalink
update for Mega
Browse files Browse the repository at this point in the history
  • Loading branch information
caternuson committed Aug 20, 2020
1 parent 7592218 commit 71f89d5
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 85 deletions.
20 changes: 10 additions & 10 deletions examples/changepassword/changepassword.ino
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/***************************************************
/***************************************************
This is an example sketch for our optical Fingerprint sensor
Designed specifically to work with the Adafruit Fingerprint sensor
----> http://www.adafruit.com/products/751
These displays use TTL Serial to communicate, 2 pins are required to
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
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.
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

#include <Adafruit_Fingerprint.h>


#if defined(__AVR__) || defined(ESP8266)
#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
Expand All @@ -34,16 +34,16 @@ Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
// Using sensor with password
//Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial, 1337);

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

Serial.begin(9600);
Serial.println("Adafruit fingerprint sensor, change password example");

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

if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Expand All @@ -64,4 +64,4 @@ void loop()
{

}


24 changes: 12 additions & 12 deletions examples/delete/delete.ino
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/***************************************************
/***************************************************
This is an example sketch for our optical Fingerprint sensor
Designed specifically to work with the Adafruit Fingerprint sensor
----> http://www.adafruit.com/products/751
These displays use TTL Serial to communicate, 2 pins are required to
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
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.
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

#include <Adafruit_Fingerprint.h>


#if defined(__AVR__) || defined(ESP8266)
#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
Expand All @@ -34,7 +34,7 @@ SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
void setup()
{
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
Expand All @@ -43,7 +43,7 @@ void setup()

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

if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Expand All @@ -55,7 +55,7 @@ void setup()

uint8_t readnumber(void) {
uint8_t num = 0;

while (num == 0) {
while (! Serial.available());
num = Serial.parseInt();
Expand All @@ -73,13 +73,13 @@ void loop() // run over and over again

Serial.print("Deleting ID #");
Serial.println(id);

deleteFingerprint(id);
}

uint8_t deleteFingerprint(uint8_t id) {
uint8_t p = -1;

p = finger.deleteModel(id);

if (p == FINGERPRINT_OK) {
Expand All @@ -96,5 +96,5 @@ uint8_t deleteFingerprint(uint8_t id) {
} else {
Serial.print("Unknown error: 0x"); Serial.println(p, HEX);
return p;
}
}
}
18 changes: 9 additions & 9 deletions examples/emptyDatabase/emptyDatabase.ino
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/***************************************************
/***************************************************
This is an example sketch for our optical Fingerprint sensor
Designed specifically to work with the Adafruit Fingerprint sensor
----> http://www.adafruit.com/products/751
These displays use TTL Serial to communicate, 2 pins are required to
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
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.
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

#include <Adafruit_Fingerprint.h>


#if defined(__AVR__) || defined(ESP8266)
#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
Expand All @@ -31,7 +31,7 @@ SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
void setup()
{
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
Expand All @@ -48,14 +48,14 @@ void setup()

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

finger.emptyDatabase();

Serial.println("Now database is empty :)");
Expand Down
34 changes: 17 additions & 17 deletions examples/enroll/enroll.ino
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
/***************************************************
/***************************************************
This is an example sketch for our optical Fingerprint sensor
Designed specifically to work with the Adafruit BMP085 Breakout
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
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
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.
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

#include <Adafruit_Fingerprint.h>


#if defined(__AVR__) || defined(ESP8266)
#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
Expand All @@ -36,7 +36,7 @@ Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

uint8_t id;

void setup()
void setup()
{
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
Expand All @@ -45,7 +45,7 @@ void setup()

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

if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Expand All @@ -66,7 +66,7 @@ void setup()

uint8_t readnumber(void) {
uint8_t num = 0;

while (num == 0) {
while (! Serial.available());
num = Serial.parseInt();
Expand All @@ -84,7 +84,7 @@ void loop() // run over and over again
}
Serial.print("Enrolling ID #");
Serial.println(id);

while (! getFingerprintEnroll() );
}

Expand Down Expand Up @@ -136,7 +136,7 @@ uint8_t getFingerprintEnroll() {
Serial.println("Unknown error");
return p;
}

Serial.println("Remove finger");
delay(2000);
p = 0;
Expand Down Expand Up @@ -190,10 +190,10 @@ uint8_t getFingerprintEnroll() {
Serial.println("Unknown error");
return p;
}

// OK converted!
Serial.print("Creating model for #"); Serial.println(id);

p = finger.createModel();
if (p == FINGERPRINT_OK) {
Serial.println("Prints matched!");
Expand All @@ -206,8 +206,8 @@ uint8_t getFingerprintEnroll() {
} else {
Serial.println("Unknown error");
return p;
}
}

Serial.print("ID "); Serial.println(id);
p = finger.storeModel(id);
if (p == FINGERPRINT_OK) {
Expand All @@ -224,7 +224,7 @@ uint8_t getFingerprintEnroll() {
} else {
Serial.println("Unknown error");
return p;
}
}

return true;
}
36 changes: 18 additions & 18 deletions examples/fingerprint/fingerprint.ino
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/***************************************************
/***************************************************
This is an example sketch for our optical Fingerprint sensor
Designed specifically to work with the Adafruit BMP085 Breakout
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
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
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.
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/


#include <Adafruit_Fingerprint.h>


#if defined(__AVR__) || defined(ESP8266)
#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
Expand All @@ -35,7 +35,7 @@ SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
void setup()
{
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
Expand All @@ -61,12 +61,12 @@ void setup()
Serial.print(F("Device address: ")); Serial.println(finger.device_addr, HEX);
Serial.print(F("Packet len: ")); Serial.println(finger.packet_len);
Serial.print(F("Baud rate: ")); Serial.println(finger.baud_rate);

finger.getTemplateCount();

if (finger.templateCount == 0) {
Serial.print("Sensor doesn't contain any fingerprint data. Please run the 'enroll' example.");
}
}
else {
Serial.println("Waiting for valid finger...");
Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
Expand Down Expand Up @@ -122,7 +122,7 @@ uint8_t getFingerprintID() {
Serial.println("Unknown error");
return p;
}

// OK converted!
p = finger.fingerSearch();
if (p == FINGERPRINT_OK) {
Expand All @@ -136,11 +136,11 @@ uint8_t getFingerprintID() {
} 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);
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);

return finger.fingerID;
}
Expand All @@ -155,9 +155,9 @@ int getFingerprintIDez() {

p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;

// found a match!
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
return finger.fingerID;
}
Loading

0 comments on commit 71f89d5

Please sign in to comment.