Compare commits

...

53 commits

Author SHA1 Message Date
Tyeth Gundry
3e9b2cdeac
Update library.properties - bump version to 2.1.3 2024-01-30 22:40:39 +00:00
Carter Nelson
c127475615
Merge pull request #69 from miselico/master
Corrected action taken after successfully storing the fingerprint in enroll example.
2024-01-24 14:49:19 -08:00
Michael Cochez
9d51eb5e32
Update enroll.ino 2024-01-24 23:45:42 +01:00
Michael Cochez
e5c63cccfb
Update enroll.ino
Rolling back code clarification.
2024-01-24 23:44:57 +01:00
Michael Cochez
5f4324cadf
Merge branch 'master' into master 2024-01-24 22:43:35 +01:00
Tyeth Gundry
f9a49801f8
Update library.properties - bump version to 2.1.2 2023-08-11 12:14:21 +01:00
Limor "Ladyada" Fried
df94f5b6a0
Merge pull request #115 from frami/master
Fixed typo in setBaudRate method
2023-08-06 12:12:34 -04:00
dherrada
d909c6673e Update CI action versions 2023-05-12 11:23:54 -04:00
Michael Fraefel
b9175cb792
Fixed typo in setBaudRate
There was a typo in the setBaudRate method. For that reason, it was not possible to change the baudrate.
2022-09-03 11:37:06 +02:00
Eva Herrada
358c6c9e43
Bump to 2.1.0 2022-06-06 16:50:12 -04:00
Limor "Ladyada" Fried
98df1bbdfc
Merge pull request #110 from TavakoliAli/addWriteRegisterInstruction
Add write register instruction.
2022-06-03 11:28:45 -04:00
Ali Tavakoli
ff739da402 Fix doxygen warnings 2022-06-03 13:16:10 +04:30
Ali Tavakoli
4c8e80560d Fix ci warnings 2022-06-03 13:02:05 +04:30
Ali Tavakoli
ca104a93f4 Formating source file with clang-format. 2022-06-03 12:58:10 +04:30
Ali Tavakoli
8331a47ad7 Add write register instruction.
To change security level we need to write register instruction.
2022-06-02 12:37:25 +04:30
Eva Herrada
9bee650682
Bump to 2.0.9 2022-05-31 14:07:54 -04:00
Limor "Ladyada" Fried
235659d917
Merge pull request #109 from ArendJan/master
Fix data buffer overflow wrong length bytes
2022-05-20 22:13:37 -04:00
Arend-Jan van Hilten
b966a01062
Fix code style mistake 2022-05-20 00:11:53 +02:00
Arend-Jan van Hilten
da24fee6ea
Fix data buffer overflow wrong length bytes
Sometimes receiving byte 6 or 7 is wrong and packet->length will be very high. There was no check that any more bytes could fit into the packet->data buffer. This could resulted in crashes or strange behavior.
2022-05-19 23:44:10 +02:00
Eva Herrada
212431922a
Bump to 2.0.8 2022-05-09 16:10:46 -04:00
Carter Nelson
bd0419c070
Merge pull request #103 from pyromanci/master
Much better Formated Source doc
2022-05-04 12:01:09 -07:00
pyromanci
46fb651f19 Replace ZFM-20_Fingerprint_Module.pdf
Replaced ZFM-20_Fingerprint_Module.pdf with the better formated one.
2022-05-04 14:37:59 -04:00
pyromanci
296b36fef4 Much better Formated Source doc
This is a much better translated version of the source document.
2022-01-19 14:08:53 -05:00
Dylan Herrada
0a64b4db9b
Bump to 2.0.7 2021-10-12 12:00:43 -04:00
Limor "Ladyada" Fried
09356393df
Merge pull request #102 from caternuson/fix_warn
Add casts to fix warns
2021-10-09 11:06:04 -04:00
caternuson
83711f6aed add casts to fix warns 2021-10-09 07:58:23 -07:00
Dylan Herrada
8d4535982b
Bump to 2.0.6 2021-09-14 11:49:43 -04:00
Limor "Ladyada" Fried
a419ade34d
Merge pull request #100 from bhelterline/master
show_fingerprint_templates fix for writing beyond array bounds
2021-09-11 19:29:43 -04:00
Brian Helterline
2225c23f7f Update show_fingerprint_templates.ino
typo!
2021-09-09 16:11:19 -07:00
Brian Helterline
9a34f466c1 Update show_fingerprint_templates.ino
fixed data movement from bytesReceived array to fingerTemplate array
2021-09-09 15:34:33 -07:00
Brian Helterline
e17cac2e2f Update show_fingerprint_templates.ino
This example wrote beyond the array bounds when fetching the fingerprint data
2021-09-09 15:07:50 -07:00
Dylan Herrada
0722ddf8aa
Bump to 2.0.5 2021-07-06 13:11:09 -04:00
Limor "Ladyada" Fried
6511150e48
Merge pull request #98 from adafruit/fix-ci
Fix ci warnings
2021-06-30 12:17:45 -04:00
hathach
e9ef326a1e clang 2021-06-30 19:30:09 +07:00
hathach
e2eb06d8a5 fix warnings, some is treated as error in esp8266 2021-06-30 19:23:47 +07:00
hathach
b8899d93d3 use matrix build 2021-06-30 19:10:44 +07:00
Dylan Herrada
4627e57209
Bump to 2.0.4 2020-10-16 16:06:33 -04:00
Limor "Ladyada" Fried
9beed22ac4
Merge pull request #89 from OnFreund/master
Support a stream for serial
2020-10-15 11:26:22 -04:00
On Freund
68041678ac Fix lint error 2020-10-15 12:15:32 +03:00
On Freund
e36e76834a Support a stream for serial 2020-10-15 11:58:55 +03:00
Dylan Herrada
72f17ac250
Bump to 2.0.3 2020-09-16 14:51:36 -04:00
Limor "Ladyada" Fried
1991a0d604
Merge pull request #86 from OnFreund/remove_deps
Remove unsused dependencies
2020-09-12 10:21:40 -04:00
On Freund
be5e5b3a0d Remove empty depends 2020-09-12 10:27:23 +03:00
On Freund
9713dbfec3 Remove unsused dependencies 2020-09-12 09:44:10 +03:00
Dylan Herrada
9e2ab6584e
Bump to 2.0.2 2020-09-07 15:49:27 -04:00
Kattni
59acece7b9
Update README 2020-09-03 16:10:34 -04:00
Carter Nelson
dae2db6857
Update library.properties 2020-08-20 15:11:31 -07:00
Limor "Ladyada" Fried
6b0a056422
Merge pull request #83 from caternuson/iss82
Update for Mega
2020-08-20 17:46:13 -04:00
caternuson
71f89d5dd9 update for Mega 2020-08-20 14:30:57 -07:00
dherrada
7592218bcc
Bump to 2.0.0 2020-07-10 16:08:09 -04:00
Limor "Ladyada" Fried
95159512c3
Update library.properties
bump
2020-07-08 13:14:17 -04:00
Limor "Ladyada" Fried
f38ea6bd8b
Merge pull request #81 from adafruit/refactor_grow
Refactor grow
2020-07-08 13:13:56 -04:00
michaelcochez
3438817c51 Corrected action taken after succesfully storing the fingerprint.
A return statement after succesfully storing the fingerprint was missing. Added a return value of 0.
When the fingerprint is taken succesfully, the program should restart instead of continuing to take the fingerprint; amended.
The program prints dots to indicate it is waiting, removed a newline being printed after each of these in one case.
2019-11-06 17:42:09 +01:00
13 changed files with 261 additions and 139 deletions

View file

@ -5,13 +5,17 @@ on: [pull_request, push, repository_dispatch]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arduino-platform: ["uno", "leonardo", "mega2560", "zero", "esp8266", "esp32", "metro_m4", "trinket_m0"]
steps:
- uses: actions/setup-python@v1
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: adafruit/ci-arduino
path: ci
@ -20,7 +24,7 @@ jobs:
run: bash ci/actions_install.sh
- name: test platforms
run: python3 ci/build_platform.py main_platforms
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}
- name: clang
run: python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .

View file

@ -93,6 +93,27 @@ Adafruit_Fingerprint::Adafruit_Fingerprint(HardwareSerial *hs,
mySerial = hwSerial;
}
/**************************************************************************/
/*!
@brief Instantiates sensor with a stream for Serial
@param serial Pointer to a Stream object
@param password 32-bit integer password (default is 0)
*/
/**************************************************************************/
Adafruit_Fingerprint::Adafruit_Fingerprint(Stream *serial, uint32_t password) {
thePassword = password;
theAddress = 0xFFFFFFFF;
hwSerial = NULL;
#if defined(__AVR__) || defined(ESP8266) || defined(FREEDOM_E300_HIFIVE1)
swSerial = NULL;
#endif
mySerial = serial;
}
/**************************************************************************/
/*!
@brief Initializes serial interface and baud rate
@ -346,8 +367,8 @@ uint8_t Adafruit_Fingerprint::LEDcontrol(uint8_t control, uint8_t speed,
/**************************************************************************/
uint8_t Adafruit_Fingerprint::fingerSearch(uint8_t slot) {
// search of slot starting thru the capacity
GET_CMD_PACKET(FINGERPRINT_SEARCH, slot, 0x00, 0x00, capacity >> 8,
capacity & 0xFF);
GET_CMD_PACKET(FINGERPRINT_SEARCH, slot, 0x00, 0x00, (uint8_t)(capacity >> 8),
(uint8_t)(capacity & 0xFF));
fingerID = 0xFFFF;
confidence = 0xFFFF;
@ -391,10 +412,64 @@ uint8_t Adafruit_Fingerprint::getTemplateCount(void) {
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::setPassword(uint32_t password) {
SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (password >> 24), (password >> 16),
(password >> 8), password);
SEND_CMD_PACKET(FINGERPRINT_SETPASSWORD, (uint8_t)(password >> 24),
(uint8_t)(password >> 16), (uint8_t)(password >> 8),
(uint8_t)(password & 0xFF));
}
/**************************************************************************/
/*!
@brief Writing module registers
@param regAdd 8-bit address of register
@param value 8-bit value will write to register
@returns <code>FINGERPRINT_OK</code> on success
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
@returns <code>FINGERPRINT_ADDRESS_ERROR</code> on register address error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::writeRegister(uint8_t regAdd, uint8_t value) {
SEND_CMD_PACKET(FINGERPRINT_WRITE_REG, regAdd, value);
}
/**************************************************************************/
/*!
@brief Change UART baudrate
@param baudrate 8-bit Uart baudrate
@returns <code>FINGERPRINT_OK</code> on success
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::setBaudRate(uint8_t baudrate) {
return (writeRegister(FINGERPRINT_BAUD_REG_ADDR, baudrate));
}
/**************************************************************************/
/*!
@brief Change security level
@param level 8-bit security level
@returns <code>FINGERPRINT_OK</code> on success
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::setSecurityLevel(uint8_t level) {
return (writeRegister(FINGERPRINT_SECURITY_REG_ADDR, level));
}
/**************************************************************************/
/*!
@brief Change packet size
@param size 8-bit packet size
@returns <code>FINGERPRINT_OK</code> on success
@returns <code>FINGERPRINT_PACKETRECIEVEERR</code> on communication error
*/
/**************************************************************************/
uint8_t Adafruit_Fingerprint::setPacketSize(uint8_t size) {
return (writeRegister(FINGERPRINT_PACKET_REG_ADDR, size));
}
/**************************************************************************/
/*!
@brief Helper function to process a packet and send it over UART to the
@ -537,6 +612,9 @@ Adafruit_Fingerprint::getStructuredPacket(Adafruit_Fingerprint_Packet *packet,
break;
}
idx++;
if ((idx + 9) >= sizeof(packet->data)) {
return FINGERPRINT_BADPACKET;
}
}
// Shouldn't get here so...
return FINGERPRINT_BADPACKET;

View file

@ -86,7 +86,40 @@
#define FINGERPRINT_LED_GRADUAL_OFF 0x06 //!< Gradually off
#define FINGERPRINT_LED_RED 0x01 //!< Red LED
#define FINGERPRINT_LED_BLUE 0x02 //!< Blue LED
#define FINGERPRINT_LED_PURPLE 0x03 //!< Purple LED
#define FINGERPRINT_LED_PURPLE 0x03 //!< Purple LEDpassword
#define FINGERPRINT_REG_ADDR_ERROR 0x1A //!< shows register address error
#define FINGERPRINT_WRITE_REG 0x0E //!< Write system register instruction
#define FINGERPRINT_BAUD_REG_ADDR 0x4 //!< BAUDRATE register address
#define FINGERPRINT_BAUDRATE_9600 0x1 //!< UART baud 9600
#define FINGERPRINT_BAUDRATE_19200 0x2 //!< UART baud 19200
#define FINGERPRINT_BAUDRATE_28800 0x3 //!< UART baud 28800
#define FINGERPRINT_BAUDRATE_38400 0x4 //!< UART baud 38400
#define FINGERPRINT_BAUDRATE_48000 0x5 //!< UART baud 48000
#define FINGERPRINT_BAUDRATE_57600 0x6 //!< UART baud 57600
#define FINGERPRINT_BAUDRATE_67200 0x7 //!< UART baud 67200
#define FINGERPRINT_BAUDRATE_76800 0x8 //!< UART baud 76800
#define FINGERPRINT_BAUDRATE_86400 0x9 //!< UART baud 86400
#define FINGERPRINT_BAUDRATE_96000 0xA //!< UART baud 96000
#define FINGERPRINT_BAUDRATE_105600 0xB //!< UART baud 105600
#define FINGERPRINT_BAUDRATE_115200 0xC //!< UART baud 115200
#define FINGERPRINT_SECURITY_REG_ADDR 0x5 //!< Security level register address
// The safety level is 1 The highest rate of false recognition , The rejection
// rate is the lowest . The safety level is 5 The lowest tate of false
// recognition, The rejection rate is the highest .
#define FINGERPRINT_SECURITY_LEVEL_1 0X1 //!< Security level 1
#define FINGERPRINT_SECURITY_LEVEL_2 0X2 //!< Security level 2
#define FINGERPRINT_SECURITY_LEVEL_3 0X3 //!< Security level 3
#define FINGERPRINT_SECURITY_LEVEL_4 0X4 //!< Security level 4
#define FINGERPRINT_SECURITY_LEVEL_5 0X5 //!< Security level 5
#define FINGERPRINT_PACKET_REG_ADDR 0x6 //!< Packet size register address
#define FINGERPRINT_PACKET_SIZE_32 0X0 //!< Packet size is 32 Byte
#define FINGERPRINT_PACKET_SIZE_64 0X1 //!< Packet size is 64 Byte
#define FINGERPRINT_PACKET_SIZE_128 0X2 //!< Packet size is 128 Byte
#define FINGERPRINT_PACKET_SIZE_256 0X3 //!< Packet size is 256 Byte
//#define FINGERPRINT_DEBUG
@ -132,6 +165,7 @@ public:
Adafruit_Fingerprint(SoftwareSerial *ss, uint32_t password = 0x0);
#endif
Adafruit_Fingerprint(HardwareSerial *hs, uint32_t password = 0x0);
Adafruit_Fingerprint(Stream *serial, uint32_t password = 0x0);
void begin(uint32_t baud);
@ -155,6 +189,10 @@ public:
uint8_t LEDcontrol(uint8_t control, uint8_t speed, uint8_t coloridx,
uint8_t count = 0);
uint8_t setBaudRate(uint8_t baudrate);
uint8_t setSecurityLevel(uint8_t level);
uint8_t setPacketSize(uint8_t size);
void writeStructuredPacket(const Adafruit_Fingerprint_Packet &p);
uint8_t getStructuredPacket(Adafruit_Fingerprint_Packet *p,
uint16_t timeout = DEFAULTTIMEOUT);
@ -178,6 +216,7 @@ public:
private:
uint8_t checkPassword(void);
uint8_t writeRegister(uint8_t regAdd, uint8_t value);
uint32_t thePassword;
uint32_t theAddress;
uint8_t recvPacket[20];

View file

@ -1,12 +1,16 @@
# Adafruit-Fingerprint-Sensor-Library [![Build Status](https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library/workflows/Arduino%20Library%20CI/badge.svg)](https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library/actions)[![Documentation](https://github.com/adafruit/ci-arduino/blob/master/assets/doxygen_badge.svg)](http://adafruit.github.io/Adafruit-Fingerprint-Sensor-Library/html/index.html)
<img src="https://cdn-shop.adafruit.com/970x728/751-03.jpg" height="300"/>
<img src="https://cdn-shop.adafruit.com/1200x900/4651-00.jpg" height="300"/>
Secure your project with biometrics - this all-in-one optical fingerprint sensor will make adding fingerprint detection and verification super simple. These modules are typically used in safes - there's a high powered DSP chip that does the image rendering, calculation, feature-finding and searching. Connect to any microcontroller or system with TTL serial, and send packets of data to take photos, detect prints, hash and search. You can also enroll new fingers directly - up to 162 finger prints can be stored in the onboard FLASH memory. There's a red LED in the lens that lights up during a photo so you know its working.
The Rugged Panel Mount Fingerprint Sensor with Bi-Color LED Ring even has an LED ring built around the detection pad, which can be set to red, blue or purple (as well as some fading/blinking effects) for a great user experience.
Designed specifically to work with the Adafruit Fingerprint sensor
Designed specifically to work with the Adafruit Fingerprint sensors
* http://www.adafruit.com/products/751
* https://www.adafruit.com/product/4651
Pick one up today in the adafruit shop!

View file

@ -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)
@ -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()
{
}

View file

@ -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)
@ -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,28 +73,26 @@ 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) {
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;
}
}
return p;
}

View file

@ -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)
@ -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 :)");

View file

@ -1,23 +1,25 @@
/***************************************************
/***************************************************
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.
Small bug-fix by Michael cochez
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)
@ -36,7 +38,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 +47,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 +68,7 @@ void setup()
uint8_t readnumber(void) {
uint8_t num = 0;
while (num == 0) {
while (! Serial.available());
num = Serial.parseInt();
@ -84,8 +86,8 @@ void loop() // run over and over again
}
Serial.print("Enrolling ID #");
Serial.println(id);
while (! getFingerprintEnroll() );
while (! getFingerprintEnroll() );
}
uint8_t getFingerprintEnroll() {
@ -99,7 +101,7 @@ uint8_t getFingerprintEnroll() {
Serial.println("Image taken");
break;
case FINGERPRINT_NOFINGER:
Serial.println(".");
Serial.print(".");
break;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
@ -136,7 +138,7 @@ uint8_t getFingerprintEnroll() {
Serial.println("Unknown error");
return p;
}
Serial.println("Remove finger");
delay(2000);
p = 0;
@ -190,10 +192,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 +208,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 +226,7 @@ uint8_t getFingerprintEnroll() {
} else {
Serial.println("Unknown error");
return p;
}
}
return true;
}

View file

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

View file

@ -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/...

View file

@ -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 <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)
@ -31,15 +31,15 @@ Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
int getFingerprintIDez();
void setup()
void setup()
{
while(!Serial);
while (!Serial);
Serial.begin(9600);
Serial.println("Fingerprint template extractor");
// set the data rate for the sensor serial port
finger.begin(57600);
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
@ -78,11 +78,11 @@ uint8_t downloadFingerprintTemplate(uint16_t id)
case FINGERPRINT_OK:
Serial.print("Template "); Serial.print(id); Serial.println(" transferring:");
break;
default:
default:
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);
@ -90,9 +90,9 @@ uint8_t downloadFingerprintTemplate(uint16_t id)
uint32_t starttime = millis();
int i = 0;
while (i < 534 && (millis() - starttime) < 20000) {
if (mySerial.available()) {
bytesReceived[i++] = mySerial.read();
}
if (mySerial.available()) {
bytesReceived[i++] = mySerial.read();
}
}
Serial.print(i); Serial.println(" bytes read.");
Serial.println("Decoding packet...");
@ -102,42 +102,41 @@ uint8_t downloadFingerprintTemplate(uint16_t id)
// filtering only the data packets
int uindx = 9, index = 0;
while (index < 534) {
while (index < uindx) ++index;
uindx += 256;
while (index < uindx) {
fingerTemplate[index++] = bytesReceived[index];
}
uindx += 2;
while (index < uindx) ++index;
uindx = index + 9;
}
memcpy(fingerTemplate + index, bytesReceived + uindx, 256); // first 256 bytes
uindx += 256; // skip data
uindx += 2; // skip checksum
uindx += 9; // skip next header
index += 256; // advance pointer
memcpy(fingerTemplate + index, bytesReceived + uindx, 256); // second 256 bytes
for (int i = 0; i < 512; ++i) {
//Serial.print("0x");
printHex(fingerTemplate[i], 2);
//Serial.print(", ");
//Serial.print("0x");
printHex(fingerTemplate[i], 2);
//Serial.print(", ");
}
Serial.println("\ndone.");
return p;
/*
uint8_t templateBuffer[256];
memset(templateBuffer, 0xff, 256); //zero out template buffer
int index=0;
uint32_t starttime = millis();
while ((index < 256) && ((millis() - starttime) < 1000))
{
uint8_t templateBuffer[256];
memset(templateBuffer, 0xff, 256); //zero out template buffer
int index=0;
uint32_t starttime = millis();
while ((index < 256) && ((millis() - starttime) < 1000))
{
if (mySerial.available())
{
templateBuffer[index] = mySerial.read();
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++)
{
}
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++)
{
for (int i = 0; i < 16; i++)
{
Serial.print("0x");
@ -145,22 +144,21 @@ uint8_t downloadFingerprintTemplate(uint16_t id)
Serial.print(", ");
}
Serial.println();
}*/
}*/
}
void printHex(int num, int precision) {
char tmp[16];
char format[128];
sprintf(format, "%%.%dX", precision);
sprintf(tmp, format, num);
Serial.print(tmp);
char tmp[16];
char format[128];
sprintf(format, "%%.%dX", precision);
sprintf(tmp, format, num);
Serial.print(tmp);
}
void loop()
{}

View file

@ -1,5 +1,5 @@
name=Adafruit Fingerprint Sensor Library
version=1.1.8
version=2.1.3
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Arduino library for interfacing to the fingerprint sensor in the Adafruit shop
@ -7,4 +7,3 @@ paragraph=Arduino library for interfacing to the fingerprint sensor in the Adafr
category=Sensors
url=https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library
architectures=*
depends=Adafruit ILI9341, Adafruit GFX Library