Skip to content

Commit 6b0a056

Browse files
authored
Merge pull request #83 from caternuson/iss82
Update for Mega
2 parents 7592218 + 71f89d5 commit 6b0a056

File tree

7 files changed

+85
-85
lines changed

7 files changed

+85
-85
lines changed

examples/changepassword/changepassword.ino

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
/***************************************************
1+
/***************************************************
22
This is an example sketch for our optical Fingerprint sensor
33
Designed specifically to work with the Adafruit Fingerprint sensor
44
----> http://www.adafruit.com/products/751
5-
These displays use TTL Serial to communicate, 2 pins are required to
5+
These displays use TTL Serial to communicate, 2 pins are required to
66
interface
7-
Adafruit invests time and resources providing this open source code,
8-
please support Adafruit and open-source hardware by purchasing
7+
Adafruit invests time and resources providing this open source code,
8+
please support Adafruit and open-source hardware by purchasing
99
products from Adafruit!
10-
Written by Limor Fried/Ladyada for Adafruit Industries.
10+
Written by Limor Fried/Ladyada for Adafruit Industries.
1111
BSD license, all text above must be included in any redistribution
1212
****************************************************/
1313

1414
#include <Adafruit_Fingerprint.h>
1515

1616

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

37-
void setup()
37+
void setup()
3838
{
3939
while (!Serial); // For Yun/Leo/Micro/Zero/...
40-
40+
4141
Serial.begin(9600);
4242
Serial.println("Adafruit fingerprint sensor, change password example");
4343

4444
// set the data rate for the sensor serial port
4545
finger.begin(19200);
46-
46+
4747
if (finger.verifyPassword()) {
4848
Serial.println("Found fingerprint sensor!");
4949
} else {
@@ -64,4 +64,4 @@ void loop()
6464
{
6565

6666
}
67-
67+

examples/delete/delete.ino

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
/***************************************************
1+
/***************************************************
22
This is an example sketch for our optical Fingerprint sensor
33
44
Designed specifically to work with the Adafruit Fingerprint sensor
55
----> http://www.adafruit.com/products/751
66
7-
These displays use TTL Serial to communicate, 2 pins are required to
7+
These displays use TTL Serial to communicate, 2 pins are required to
88
interface
9-
Adafruit invests time and resources providing this open source code,
10-
please support Adafruit and open-source hardware by purchasing
9+
Adafruit invests time and resources providing this open source code,
10+
please support Adafruit and open-source hardware by purchasing
1111
products from Adafruit!
1212
13-
Written by Limor Fried/Ladyada for Adafruit Industries.
13+
Written by Limor Fried/Ladyada for Adafruit Industries.
1414
BSD license, all text above must be included in any redistribution
1515
****************************************************/
1616

1717
#include <Adafruit_Fingerprint.h>
1818

1919

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

3535
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
3636

37-
void setup()
37+
void setup()
3838
{
3939
Serial.begin(9600);
4040
while (!Serial); // For Yun/Leo/Micro/Zero/...
@@ -43,7 +43,7 @@ void setup()
4343

4444
// set the data rate for the sensor serial port
4545
finger.begin(57600);
46-
46+
4747
if (finger.verifyPassword()) {
4848
Serial.println("Found fingerprint sensor!");
4949
} else {
@@ -55,7 +55,7 @@ void setup()
5555

5656
uint8_t readnumber(void) {
5757
uint8_t num = 0;
58-
58+
5959
while (num == 0) {
6060
while (! Serial.available());
6161
num = Serial.parseInt();
@@ -73,13 +73,13 @@ void loop() // run over and over again
7373

7474
Serial.print("Deleting ID #");
7575
Serial.println(id);
76-
76+
7777
deleteFingerprint(id);
7878
}
7979

8080
uint8_t deleteFingerprint(uint8_t id) {
8181
uint8_t p = -1;
82-
82+
8383
p = finger.deleteModel(id);
8484

8585
if (p == FINGERPRINT_OK) {
@@ -96,5 +96,5 @@ uint8_t deleteFingerprint(uint8_t id) {
9696
} else {
9797
Serial.print("Unknown error: 0x"); Serial.println(p, HEX);
9898
return p;
99-
}
99+
}
100100
}

examples/emptyDatabase/emptyDatabase.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
/***************************************************
1+
/***************************************************
22
This is an example sketch for our optical Fingerprint sensor
33
Designed specifically to work with the Adafruit Fingerprint sensor
44
----> http://www.adafruit.com/products/751
5-
These displays use TTL Serial to communicate, 2 pins are required to
5+
These displays use TTL Serial to communicate, 2 pins are required to
66
interface
7-
Adafruit invests time and resources providing this open source code,
8-
please support Adafruit and open-source hardware by purchasing
7+
Adafruit invests time and resources providing this open source code,
8+
please support Adafruit and open-source hardware by purchasing
99
products from Adafruit!
10-
Written by Limor Fried/Ladyada for Adafruit Industries.
10+
Written by Limor Fried/Ladyada for Adafruit Industries.
1111
BSD license, all text above must be included in any redistribution
1212
****************************************************/
1313

1414
#include <Adafruit_Fingerprint.h>
1515

1616

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

3232
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
3333

34-
void setup()
34+
void setup()
3535
{
3636
Serial.begin(9600);
3737
while (!Serial); // For Yun/Leo/Micro/Zero/...
@@ -48,14 +48,14 @@ void setup()
4848

4949
// set the data rate for the sensor serial port
5050
finger.begin(57600);
51-
51+
5252
if (finger.verifyPassword()) {
5353
Serial.println("Found fingerprint sensor!");
5454
} else {
5555
Serial.println("Did not find fingerprint sensor :(");
5656
while (1);
5757
}
58-
58+
5959
finger.emptyDatabase();
6060

6161
Serial.println("Now database is empty :)");

examples/enroll/enroll.ino

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
/***************************************************
1+
/***************************************************
22
This is an example sketch for our optical Fingerprint sensor
33
4-
Designed specifically to work with the Adafruit BMP085 Breakout
4+
Designed specifically to work with the Adafruit BMP085 Breakout
55
----> http://www.adafruit.com/products/751
66
7-
These displays use TTL Serial to communicate, 2 pins are required to
7+
These displays use TTL Serial to communicate, 2 pins are required to
88
interface
9-
Adafruit invests time and resources providing this open source code,
10-
please support Adafruit and open-source hardware by purchasing
9+
Adafruit invests time and resources providing this open source code,
10+
please support Adafruit and open-source hardware by purchasing
1111
products from Adafruit!
1212
13-
Written by Limor Fried/Ladyada for Adafruit Industries.
13+
Written by Limor Fried/Ladyada for Adafruit Industries.
1414
BSD license, all text above must be included in any redistribution
1515
****************************************************/
1616

1717
#include <Adafruit_Fingerprint.h>
1818

1919

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

3737
uint8_t id;
3838

39-
void setup()
39+
void setup()
4040
{
4141
Serial.begin(9600);
4242
while (!Serial); // For Yun/Leo/Micro/Zero/...
@@ -45,7 +45,7 @@ void setup()
4545

4646
// set the data rate for the sensor serial port
4747
finger.begin(57600);
48-
48+
4949
if (finger.verifyPassword()) {
5050
Serial.println("Found fingerprint sensor!");
5151
} else {
@@ -66,7 +66,7 @@ void setup()
6666

6767
uint8_t readnumber(void) {
6868
uint8_t num = 0;
69-
69+
7070
while (num == 0) {
7171
while (! Serial.available());
7272
num = Serial.parseInt();
@@ -84,7 +84,7 @@ void loop() // run over and over again
8484
}
8585
Serial.print("Enrolling ID #");
8686
Serial.println(id);
87-
87+
8888
while (! getFingerprintEnroll() );
8989
}
9090

@@ -136,7 +136,7 @@ uint8_t getFingerprintEnroll() {
136136
Serial.println("Unknown error");
137137
return p;
138138
}
139-
139+
140140
Serial.println("Remove finger");
141141
delay(2000);
142142
p = 0;
@@ -190,10 +190,10 @@ uint8_t getFingerprintEnroll() {
190190
Serial.println("Unknown error");
191191
return p;
192192
}
193-
193+
194194
// OK converted!
195195
Serial.print("Creating model for #"); Serial.println(id);
196-
196+
197197
p = finger.createModel();
198198
if (p == FINGERPRINT_OK) {
199199
Serial.println("Prints matched!");
@@ -206,8 +206,8 @@ uint8_t getFingerprintEnroll() {
206206
} else {
207207
Serial.println("Unknown error");
208208
return p;
209-
}
210-
209+
}
210+
211211
Serial.print("ID "); Serial.println(id);
212212
p = finger.storeModel(id);
213213
if (p == FINGERPRINT_OK) {
@@ -224,7 +224,7 @@ uint8_t getFingerprintEnroll() {
224224
} else {
225225
Serial.println("Unknown error");
226226
return p;
227-
}
227+
}
228228

229229
return true;
230230
}

examples/fingerprint/fingerprint.ino

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
/***************************************************
1+
/***************************************************
22
This is an example sketch for our optical Fingerprint sensor
33
4-
Designed specifically to work with the Adafruit BMP085 Breakout
4+
Designed specifically to work with the Adafruit BMP085 Breakout
55
----> http://www.adafruit.com/products/751
66
7-
These displays use TTL Serial to communicate, 2 pins are required to
7+
These displays use TTL Serial to communicate, 2 pins are required to
88
interface
9-
Adafruit invests time and resources providing this open source code,
10-
please support Adafruit and open-source hardware by purchasing
9+
Adafruit invests time and resources providing this open source code,
10+
please support Adafruit and open-source hardware by purchasing
1111
products from Adafruit!
1212
13-
Written by Limor Fried/Ladyada for Adafruit Industries.
13+
Written by Limor Fried/Ladyada for Adafruit Industries.
1414
BSD license, all text above must be included in any redistribution
1515
****************************************************/
1616

1717

1818
#include <Adafruit_Fingerprint.h>
1919

2020

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

3636
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
3737

38-
void setup()
38+
void setup()
3939
{
4040
Serial.begin(9600);
4141
while (!Serial); // For Yun/Leo/Micro/Zero/...
@@ -61,12 +61,12 @@ void setup()
6161
Serial.print(F("Device address: ")); Serial.println(finger.device_addr, HEX);
6262
Serial.print(F("Packet len: ")); Serial.println(finger.packet_len);
6363
Serial.print(F("Baud rate: ")); Serial.println(finger.baud_rate);
64-
64+
6565
finger.getTemplateCount();
6666

6767
if (finger.templateCount == 0) {
6868
Serial.print("Sensor doesn't contain any fingerprint data. Please run the 'enroll' example.");
69-
}
69+
}
7070
else {
7171
Serial.println("Waiting for valid finger...");
7272
Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
@@ -122,7 +122,7 @@ uint8_t getFingerprintID() {
122122
Serial.println("Unknown error");
123123
return p;
124124
}
125-
125+
126126
// OK converted!
127127
p = finger.fingerSearch();
128128
if (p == FINGERPRINT_OK) {
@@ -136,11 +136,11 @@ uint8_t getFingerprintID() {
136136
} else {
137137
Serial.println("Unknown error");
138138
return p;
139-
}
140-
139+
}
140+
141141
// found a match!
142-
Serial.print("Found ID #"); Serial.print(finger.fingerID);
143-
Serial.print(" with confidence of "); Serial.println(finger.confidence);
142+
Serial.print("Found ID #"); Serial.print(finger.fingerID);
143+
Serial.print(" with confidence of "); Serial.println(finger.confidence);
144144

145145
return finger.fingerID;
146146
}
@@ -155,9 +155,9 @@ int getFingerprintIDez() {
155155

156156
p = finger.fingerFastSearch();
157157
if (p != FINGERPRINT_OK) return -1;
158-
158+
159159
// found a match!
160-
Serial.print("Found ID #"); Serial.print(finger.fingerID);
160+
Serial.print("Found ID #"); Serial.print(finger.fingerID);
161161
Serial.print(" with confidence of "); Serial.println(finger.confidence);
162-
return finger.fingerID;
162+
return finger.fingerID;
163163
}

0 commit comments

Comments
 (0)