-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deleteModel function deletes a fingerprint from the sensor at the specified ID
- Loading branch information
1 parent
e156f79
commit 57b70ab
Showing
4 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//Leo_passthru | ||
// Allows Leonardo to pass serial data between fingerprint reader and Windows. | ||
// | ||
// Red connects to +5V | ||
// Black connects to Ground | ||
// Green goes to Digital 0 | ||
// White goes to Digital 1 | ||
|
||
void setup() { | ||
// put your setup code here, to run once: | ||
Serial1.begin(57600); | ||
Serial.begin(57600); | ||
} | ||
|
||
void loop() { | ||
|
||
while (Serial.available()) | ||
Serial1.write(Serial.read()); | ||
while (Serial1.available()) | ||
Serial.write(Serial1.read()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/*************************************************** | ||
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> | ||
#if ARDUINO >= 100 | ||
#include <SoftwareSerial.h> | ||
#else | ||
#include <NewSoftSerial.h> | ||
#endif | ||
|
||
uint8_t getFingerprintEnroll(uint8_t id); | ||
|
||
|
||
// pin #2 is IN from sensor (GREEN wire) | ||
// pin #3 is OUT from arduino (WHITE wire) | ||
#if ARDUINO >= 100 | ||
SoftwareSerial mySerial(2, 3); | ||
//#define mySerial Serial1 | ||
#else | ||
NewSoftSerial mySerial(2, 3); | ||
#endif | ||
|
||
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial); | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
Serial.println("Delete Finger"); | ||
|
||
// 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); | ||
} | ||
} | ||
|
||
void loop() // run over and over again | ||
{ | ||
Serial.println("Type in the ID # you want delete..."); | ||
uint8_t id = 0; | ||
while (true) { | ||
while (! Serial.available()); | ||
char c = Serial.read(); | ||
if (! isdigit(c)) break; | ||
id *= 10; | ||
id += c - '0'; | ||
} | ||
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) { | ||
Serial.println("Deleted!"); | ||
} else if (p == FINGERPRINT_PACKETRECIEVEERR) { | ||
Serial.println("Communication error"); | ||
return p; | ||
} else if (p == FINGERPRINT_BADLOCATION) { | ||
Serial.println("Could not delete in that location"); | ||
return p; | ||
} else if (p == FINGERPRINT_FLASHERR) { | ||
Serial.println("Error writing to flash"); | ||
return p; | ||
} else { | ||
Serial.print("Unknown error: 0x"); Serial.println(p, HEX); | ||
return p; | ||
} | ||
} |