MFRC522: More then one UID correct

Hello. I have the following code and it’s working smoothly.

But what I should have is the possibility to scan another RFID card and the puzzle should also be solved.

I tried to change it from (works):

if(currentIDs[i] != correctIDs1[i]) {

to (doesn’t work):

if(currentIDs[i] != correctIDs1[i] || currentIDs[i] != correctIDs2[i]) {

Here to full code.

// LIBRARIES
#include <SPI.h>
#include <MFRC522.h>

// CONSTANTS
const byte numReaders = 1;
const byte ssPins[] = {10};
const byte resetPin = 8;
const byte lockPin = A0;
const String correctIDs1[] = {"4178ea3e4d80"};
const String correctIDs2[] = {"46ea422a5880"};
const String correctIDs3[] = {"441c822a5880"};

MFRC522 mfrc522[numReaders];
String currentIDs[numReaders];


void setup() {
  Serial.begin(9600);
  pinMode(lockPin, OUTPUT);
  digitalWrite(lockPin, LOW);
  SPI.begin();

  for (uint8_t i=0; i<numReaders; i++) {
    mfrc522[i].PCD_Init(ssPins[i], resetPin);
    Serial.print(F("Reader #"));
    Serial.print(i);
    Serial.print(F(" initialised on pin "));
    Serial.print(String(ssPins[i]));
    Serial.print(F(". Antenna strength: "));
    Serial.print(mfrc522[i].PCD_GetAntennaGain());
    Serial.print(F(". Version : "));
    mfrc522[i].PCD_DumpVersionToSerial();
    delay(1000);
  }
  Serial.println(F("--- END SETUP ---")); 
}


void loop() {
  boolean puzzleSolved = true;
  boolean changedValue = false;
  for (uint8_t i=0; i<numReaders; i++) {
    mfrc522[i].PCD_Init();
    String readRFID = "";
      if(mfrc522[i].PICC_IsNewCardPresent() && mfrc522[i].PICC_ReadCardSerial()) {
      readRFID = dump_byte_array(mfrc522[i].uid.uidByte, mfrc522[i].uid.size);
    }
    if(readRFID != currentIDs[i]){
      changedValue = true;
      currentIDs[i] = readRFID;
    }
    if(currentIDs[i] != correctIDs1[i] || currentIDs[i] != correctIDs2[i]) {
      puzzleSolved = false;
    }
    mfrc522[i].PICC_HaltA();
    mfrc522[i].PCD_StopCrypto1(); 
  }

  if(changedValue){
    for (uint8_t i=0; i<numReaders; i++) {
      Serial.print(F("Reader #"));
      Serial.print(String(i));
      Serial.print(F(" on Pin #"));
      Serial.print(String((ssPins[i])));
      Serial.print(F(" detected tag: "));
      Serial.println(currentIDs[i]);
    }
    Serial.println(F("---"));
  }

  if(puzzleSolved){
    onSolve();
  }
}

void onSolve(){
  Serial.println(F("Puzzle Solved!"));
  //digitalWrite(lockPin, HIGH);
  //delay(500);
  //digitalWrite(lockPin, LOW);
  //delay(500);
  //digitalWrite(lockPin, HIGH);
  //delay(5000);
  //digitalWrite(lockPin, LOW);
  while(true) {
    delay(1000);
  }
}

String dump_byte_array(byte *buffer, byte bufferSize) {
  String read_rfid = "";
  for (byte i=0; i<bufferSize; i++) {
    read_rfid = read_rfid + String(buffer[i], HEX);
  }
  return read_rfid;
}

Does anyone have me a hint? Thank You so much, Thomas.

It's a negative check, so 'or' is the wrong operator, 'and' is correct here.

if (currentIDs[i] != correctIDs1[i] && currentIDs[i] != correctIDs2[i]) {

The reason is simple. First case: If your fruit is not an apple you throw it away. Second case: If your fruit is not an apple or your fruit is not a pear you throw it away. In that case you throw away all fruits because every fruit is either not an apple or not a pear.

But if you say: If your fruit is not an apple and not a pear you throw it away. In that case you'll keep apples and pears but all other fruits are thrown away.

You should eliminate the use of the String class (on the AVR platform) if you want to run that sketch over longer periods of time.

Thank You so much...!!!