diff --git a/examples/changepassword/changepassword.ino b/examples/changepassword/changepassword.ino index a55043d..bc98361 100644 --- a/examples/changepassword/changepassword.ino +++ b/examples/changepassword/changepassword.ino @@ -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 -#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) @@ -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 { @@ -64,4 +64,4 @@ void loop() { } - + diff --git a/examples/delete/delete.ino b/examples/delete/delete.ino index 5260ec2..563b4b7 100644 --- a/examples/delete/delete.ino +++ b/examples/delete/delete.ino @@ -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 -#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) @@ -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/... @@ -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 { @@ -55,7 +55,7 @@ void setup() uint8_t readnumber(void) { uint8_t num = 0; - + while (num == 0) { while (! Serial.available()); num = Serial.parseInt(); @@ -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) { @@ -96,5 +96,5 @@ uint8_t deleteFingerprint(uint8_t id) { } else { Serial.print("Unknown error: 0x"); Serial.println(p, HEX); return p; - } + } } diff --git a/examples/emptyDatabase/emptyDatabase.ino b/examples/emptyDatabase/emptyDatabase.ino index ad5f554..acd6384 100644 --- a/examples/emptyDatabase/emptyDatabase.ino +++ b/examples/emptyDatabase/emptyDatabase.ino @@ -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 -#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) @@ -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/... @@ -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 :)"); diff --git a/examples/enroll/enroll.ino b/examples/enroll/enroll.ino index c2c21d9..19fbb40 100644 --- a/examples/enroll/enroll.ino +++ b/examples/enroll/enroll.ino @@ -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 -#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) @@ -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/... @@ -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 { @@ -66,7 +66,7 @@ void setup() uint8_t readnumber(void) { uint8_t num = 0; - + while (num == 0) { while (! Serial.available()); num = Serial.parseInt(); @@ -84,7 +84,7 @@ void loop() // run over and over again } Serial.print("Enrolling ID #"); Serial.println(id); - + while (! getFingerprintEnroll() ); } @@ -136,7 +136,7 @@ uint8_t getFingerprintEnroll() { Serial.println("Unknown error"); return p; } - + Serial.println("Remove finger"); delay(2000); p = 0; @@ -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!"); @@ -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) { @@ -224,7 +224,7 @@ uint8_t getFingerprintEnroll() { } else { Serial.println("Unknown error"); return p; - } + } return true; } diff --git a/examples/fingerprint/fingerprint.ino b/examples/fingerprint/fingerprint.ino index e19b588..f175784 100644 --- a/examples/fingerprint/fingerprint.ino +++ b/examples/fingerprint/fingerprint.ino @@ -1,16 +1,16 @@ -/*************************************************** +/*************************************************** 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 ****************************************************/ @@ -18,7 +18,7 @@ #include -#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) @@ -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/... @@ -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"); @@ -122,7 +122,7 @@ uint8_t getFingerprintID() { Serial.println("Unknown error"); return p; } - + // OK converted! p = finger.fingerSearch(); if (p == FINGERPRINT_OK) { @@ -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; } @@ -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; } diff --git a/examples/ledcontrol/ledcontrol.ino b/examples/ledcontrol/ledcontrol.ino index fa069aa..d591249 100644 --- a/examples/ledcontrol/ledcontrol.ino +++ b/examples/ledcontrol/ledcontrol.ino @@ -1,13 +1,13 @@ -/*************************************************** +/*************************************************** This is an example sketch for our optical Fingerprint sensor with LED ring - 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 ****************************************************/ @@ -16,7 +16,7 @@ -#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) @@ -32,7 +32,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/... diff --git a/examples/show_fingerprint_templates/show_fingerprint_templates.ino b/examples/show_fingerprint_templates/show_fingerprint_templates.ino index 4d56095..f180220 100644 --- a/examples/show_fingerprint_templates/show_fingerprint_templates.ino +++ b/examples/show_fingerprint_templates/show_fingerprint_templates.ino @@ -1,18 +1,18 @@ -/*************************************************** +/*************************************************** This is an example sketch for our optical Fingerprint sensor - 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 -#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) @@ -31,7 +31,7 @@ Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial); int getFingerprintIDez(); -void setup() +void setup() { while(!Serial); Serial.begin(9600); @@ -39,7 +39,7 @@ void setup() // set the data rate for the sensor serial port finger.begin(57600); - + if (finger.verifyPassword()) { Serial.println("Found fingerprint sensor!"); } else { @@ -82,7 +82,7 @@ uint8_t downloadFingerprintTemplate(uint16_t id) Serial.print("Unknown error "); Serial.println(p); return p; } - + // one data packet is 267 bytes. in one data packet, 11 bytes are 'usesless' :D uint8_t bytesReceived[534]; // 2 data packets memset(bytesReceived, 0xff, 534); @@ -132,9 +132,9 @@ uint8_t downloadFingerprintTemplate(uint16_t id) index++; } } - + Serial.print(index); Serial.println(" bytes read"); - + //dump entire templateBuffer. This prints out 16 lines of 16 bytes for (int count= 0; count < 16; count++) { @@ -153,9 +153,9 @@ uint8_t downloadFingerprintTemplate(uint16_t id) void printHex(int num, int precision) { char tmp[16]; char format[128]; - + sprintf(format, "%%.%dX", precision); - + sprintf(tmp, format, num); Serial.print(tmp); }