Hola, en primer lugar me presento, soy Pepe y resido en Valencia, estoy realizando un miniproyecto para el arranque de mi moto con un sensor de huella dactilar, el caso es que el programa compila y lo sube correctamente y funciona, el problema viene cuando le quito la alimentación al arduino UNO y se la vuelvo a dar el sensor de huella no funciona a no ser que presione el botón de reset del arduino varias veces o recargue el programa, ¿sabéis esto como se puede solucionar?
os adjunto el codigo que total no he hecho nada sino que usar la libreria
/***************************************************
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>
// On Leonardo/Micro or others with hardware serial, use those! #0 is green wire, #1 is white
// uncomment this line:
// #define mySerial Serial1
// 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)
// comment these two lines if using hardware serial
#include <SoftwareSerial.h>
#include <Wtv020sd16p.h>
int resetPin = 4; // The pin number of the reset pin.
int clockPin = 5; // The pin number of the clock pin.
int dataPin = 6; // The pin number of the data pin.
int busyPin = 7; // The pin number of the busy pin.
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
void setup()
{
finger.begin(57600);
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
delay(100);
Serial.println("\n\nAdafruit finger detect test");
// set the data rate for the sensor serial port
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1) { delay(1); }
}
finger.getTemplateCount();
Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
Serial.println("Waiting for valid finger...");
wtv020sd16p.reset();
}
void loop() // run over and over again
{
getFingerprintIDez();
delay(50); //don't ned to run this at full speed.
}
// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;
p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;
p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;
// found a match!
if (finger.fingerID == 1){
Serial.println("Huella de Pepe");
wtv020sd16p.playVoice(1);
delay(2000);
wtv020sd16p.playVoice(2);
delay(2000);
}
return finger.fingerID;
}
el sensor que uso es este:
muchas gracias y un saludo