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
3636Adafruit_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: " println (finger.device_addr , HEX);
6262  Serial.print (F (" Packet len: " println (finger.packet_len );
6363  Serial.print (F (" Baud rate: " 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 " 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 #" print (finger.fingerID );  
143-   Serial.print ("  with confidence of " println (finger.confidence );  
142+   Serial.print (" Found ID #" print (finger.fingerID );
143+   Serial.print ("  with confidence of " 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 #" print (finger.fingerID );  
160+   Serial.print (" Found ID #" print (finger.fingerID );
161161  Serial.print ("  with confidence of " println (finger.confidence );
162-   return  finger.fingerID ;  
162+   return  finger.fingerID ;
163163}
0 commit comments