Adafruit_Fingerprint.cpp Error?
Moderators: adafruit_support_bill, adafruit

Adafruit_Fingerprint.cpp Error?

by tomcom on Mon Jan 07, 2013 4:06 pm

Hello

I think I have found a mistake in Adafruit_Fingerprint.cpp.

I have an Arduino Leonardo
On the Leonardo's fingerprint is on pin 2 and pin 3 is not correct.

With Pins 8 and 9, the communication with the fingerprint to work properly.
/ / Pin # 8 is IN from sensor (RED wire)
/ / Pin # 9 is OUT from arduino (WHITE wire)
Serial mySerial software (8, 9);

error:
If no finger on the fingerprint, the Adruino started at the end of the loop again and again.(Reset)
When a finger is scanned, the program runs correctly.

The reason I'm in the
p = uint8_t finger.getImage ();
found

is line 62:
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint :: getImage (void) {
uint8_t packet [] = {FINGERPRINT_GETIMAGE};


to line 62:
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint :: getImage (void) {
uint8_t packet [] = {FINGERPRINT_GETIMAGE, 0x00};


Carry this change, the Arduino runs properly with the fingerprint!
(no reset at the loop-end)


Also change:
is line 82:
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint model :: create (void) {
uint8_t packet [] = {FINGERPRINT_REGMODEL};


to line 82:
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint model :: create (void) {
uint8_t packet [] = {FINGERPRINT_REGMODEL, 0x00};


Also change:
is line 103:
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint :: empty database (void) {
uint8_t packet [] = {FINGERPRINT_EMPTY};


to line 103:
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint :: empty database (void) {
uint8_t packet [] = {FINGERPRINT_EMPTY, 0x00};


Also change:
is line 135:
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint :: getTemplateCount (void) {
template count = 0xFFFF;
/ / Get number of templates in memory
uint8_t packet [] = {FINGERPRINT_TEMPLATECOUNT};


to line 135:
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint :: getTemplateCount (void) {
template count = 0xFFFF;
/ / Get number of templates in memory
uint8_t packet [] = {FINGERPRINT_TEMPLATECOUNT, 0x00};


I hope that it serves some users.

much greetings
tomcom
tomcom
 
Posts: 2
Joined: Mon Jan 07, 2013 3:09 pm

Re: Adafruit_Fingerprint.cpp Error?

by adafruit_support_bill on Mon Jan 07, 2013 9:25 pm

I think I have found a mistake in Adafruit_Fingerprint.cpp.

This is not a mistake in the code as the code was written for (and works on) standard Arduinos. The Leonardo is quite different from previous Arduinos. Among other incompatibilities, it does not support SoftSerial on all pins.

But thank you for bringing this to our attention. We will make note of this in the tutorial.

http://vort.org/2012/05/25/trouble-soft ... -leonardo/
http://arduino.cc/en/Reference/SoftwareSerial
User avatar
adafruit_support_bill
 
Posts: 29042
Joined: Sat Feb 07, 2009 9:11 am

Re: Adafruit_Fingerprint.cpp Error?

by tomcom on Tue Jan 08, 2013 4:41 pm

The Code shud by:
Code: Select all | TOGGLE FULL SIZE
uint8_t Adafruit_Fingerprint::getImage(void) {
  uint8_t packet[] = {FINGERPRINT_GETIMAGE, 0x00 };
  writePacket(theAddress, FINGERPRINT_COMMANDPACKET, 3, packet);
  uint8_t len = getReply(packet);
 
  if ((len != 1) && (packet[0] != FINGERPRINT_ACKPACKET))
   return -1;
  return packet[1];
}


wenn you have
uint8_t packet[] = {FINGERPRINT_GETIMAGE};

and
return packet[1];

Then you the packet[1] show to NILL!!

Best Greeting
tomcom
tomcom
 
Posts: 2
Joined: Mon Jan 07, 2013 3:09 pm