I am trying to use two fingerprint sensors with an arduino yun, but I can not use the functions.
Only the sensor that is connected to the first serial port emulated by SoftwareSerial works, for example:
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>
uint8_t id = 0;
int sensor = 0;
boolean flag = true;
SoftwareSerial mySerial = SoftwareSerial(11, 12);
SoftwareSerial mySerial2 = SoftwareSerial(8, 9);
Adafruit_Fingerprint finger2 = Adafruit_Fingerprint(&mySerial2);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
Only the sensor connected to port 11 and port 12 works, the other sensor is not found.
void verificaSensor()
{
while(1)
{
Serial.println("Informe o sensor desejado (1 ou 2)");
sensor = readnumber();
if(sensor == 1)
{
mySerial.listen();
delay(1000);
finger.begin(57600);
Serial.println("Sensor 1 quase encontrado ;)");
if (finger.verifyPassword()) {
Serial.println("Sensor 1 encontrado :D");
flag = true;
return;
} else {
Serial.println("Sensor 1 não encontrado :(");
flag = false;
return;
}
}else if(sensor == 2)
{
mySerial2.listen();
delay(1000);
finger2.begin(57600);
Serial.println("Sensor 2 quase encontrado ;)");
if (finger2.verifyPassword()) {
Serial.println("Sensor 2 encontrado :D");
flag = true;
return;
} else {
Serial.println("Sensor 2 não encontrado :(");
flag = false;
return;
}
}else
{
Serial.println("Informe o sensor desejado (1 ou 2)");
}
}
}
Has anyone ever been in this situation?
The full code added appended.
tcc.zip (4.29 KB)