I have a project were I am controlling a set of locks with a fingerprint sensor and 3X4 keypad and Mobile App. I have Tried Running them but both of them Only run when their sketch is compiled or uploaded. Cant Run both together by uploading both the sketches on a single arduino device. Can You please help me to let me know that i can run both together on a single device or i have to buy another arduino and upload diffrent sketches on them? or can i combine both the codes to run at a time where i can use fingerprint and keypad together?
I am uploading both of my codes Fingerprint and Keypad Respectively
Waiting for your response
post code in-line using code tags please. hard to Read attachments from mobile phone
also define what you are trying to achieve. if there is a sequence of events or whatever that needs to happen, then you need to build a state machine (for example) to handle the sequence of events and wait for the keypad or fingerprint at the right time
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
void setup()
{
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
delay(100);
Serial.println("fingertest");
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
// 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) {
delay(1);
}
}
finger.getTemplateCount();
Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
Serial.println("Waiting for valid finger...");
}
void loop() // run over and over again
{
getFingerprintIDez();
delay(50); //don't ned to run this at full speed.
digitalWrite(12, LOW);
digitalWrite(11, LOW);
}
uint8_t getFingerprintID() {
uint8_t p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image taken");
break;
case FINGERPRINT_NOFINGER:
Serial.println("No finger detected");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_IMAGEFAIL:
Serial.println("Imaging error");
return p;
default:
Serial.println("Unknown error");
return p;
}
// OK success!
p = finger.image2Tz();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
return p;
default:
Serial.println("Unknown error");
return p;
}
// OK converted!
p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK) {
Serial.println("Found a print match!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return p;
} else if (p == FINGERPRINT_NOTFOUND) {
Serial.println("Did not find a match");
return p;
} else {
Serial.println("Unknown error");
return p;
}
{digitalWrite(11, HIGH);
delay(3000);
digitalWrite(11, LOW);
Serial.print("Not Found");
Serial.print("Error");
return finger.fingerID;
}
// found a match!
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}
// 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!
{
digitalWrite(12, HIGH);
delay(3000);
digitalWrite(12, LOW);
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
} }
I have attached relay finger print, and keypad with my ardiuno device and the relay is attached with a solenoid 12 v door lock, i want my door lock to work whenever i use my finger print or password diffrently , means the door should open weather i want it to open using my fingerprint or keypad .
so whats the solution for this can you please help? What i have to do i have no idea should i use another ardino device for using the pin 2,3 diffrent times or should i change the code , please help
change the pins of the keypad to something else and connect that way....
for the code, it seems this function
// returns -1 if failed, otherwise returns ID #
int checkFingerPrint()
{
uint8_t r = finger.getImage();
if (r != FINGERPRINT_OK) return -1;
r = finger.image2Tz();
if (r != FINGERPRINT_OK) return -1;
r = finger.fingerFastSearch();
if (r != FINGERPRINT_OK) return -1;
// found a match!
return finger.fingerID ; // with confidence of finger.confidence
}
would test a finger print and return something different than -1 if a fingerprint is found.
Can You Please Merge the codes into a single program in order to run because i am totally new to aurdino and i don't know much about merging or aurdino coding kindly help
Dear that's not cheating the teachers has allowed us to take help from anywhere ,, i have tried my best and still trying since 3 days to solve this problem but can't.
Basically i want my realy to work weather i use my finger print or my pin code , there is no scnerio that what will use first the relay should work on both CASES seprately, can you please combine both codes in such a way that i can run both keypad+ fingerprint whatever i want to use.