Two fingerprint sensors Arduino yun

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)

You cannot have two SoftwareSerial objects listening at the same moment.

I'm using .listen () to restrict who is communicating at each time.

But it's still not working.

finger2.begin(57600);

I never saw SoftwareSerial to work reliably above 9600 baud unless you have an extremely timing tolerant communication partner.

Calling the finger.begin() method (which calls SoftwareSerial.begin()) make the listen() call before obsolete.

Remove the delay() calls. They are not needed.

But it's still not working.

Define what that means. What do you send, what do you get?