I am using both an RFID and a fingerprint sensor in my project. When running the program, the RFID is detected but the fingerprint sensor is not detected and hence my code is not going forward.
Here is my code
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
#include <MFRC522.h>
#include <SPI.h>
#define SAD 10
#define RST 5
MFRC522 nfc(SAD, RST);
uint8_t id;
uint8_t getFingerprintEnroll();
int getFingerprintIDez();
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
void setup() {
SPI.begin();
Serial.begin(115200);
Serial.println("Looking for MFRC522.");
nfc.begin();
byte version = nfc.getFirmwareVersion();
if (! version) {
Serial.print("Didn't find MFRC522 board.");
while (1); //halt
}
Serial.print("Found chip MFRC522 ");
Serial.print("Firmware ver. 0x");
Serial.print(version, HEX);
Serial.println(".");
Serial.begin(9600);
Serial.println("Fingerprint and RFID Test");
finger.begin(57600);
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1);
}
}
char abc;
void loop() {
abc = Serial.read();
switch (abc) {
case '1': {
//Enroll method
}
break ;
case '2': {
//verify method
}break;
case '3': {
//rfid method
}
}
}
Fingerprint and RFID Test
in yoursetup()
?fingerprint and rfid test
is working if I writerfid.init()
after this code. if I write beforefingerprint and rfid test
then it shows nothing