[Solved] help adding RFID tags to sketch

Please can anyone help me with my project because its driving me nuts.
I made a project that unlocks my door with one RFID tag and it works flawlessly, but i couldn't add more tags.
what is the best way to do it?

#include <Servo.h> 
#include <NewSoftSerial.h>
#define MY_TAG_CODE "3200A0346D5D"
Servo myservo;  
NewSoftSerial RFID(2, 3);
String msg;
int locked = 180;
int unlocked = 0;
int trigger = 0;
 
void setup() 
{
  myservo.attach(9);  

  Serial.begin(9600);
  Serial.println("Serial Ready");

  RFID.begin(9600);
  Serial.println("RFID Ready");

}
char c;
 
void loop() 
{
  while(RFID.available()>0)
  {
    c=RFID.read(); 
    msg += c;
    delay(1);
   //Serial.println(msg);  
   //Serial.println(msg.length());
  }
  msg=msg.substring(1,13);

  if(msg.indexOf(MY_TAG_CODE)>=0) 
  {
  (trigger = 1);
   Serial.println("Card Accepted");
  digitalWrite(13, HIGH);   // set the LED on
  delay(200);              // wait 
  digitalWrite(13, LOW);    // set the LED off 
  }

  if (trigger == 1)
  {
 Serial.println("Door unlocked");
  myservo.write(unlocked);
  delay(10000);                                     
 myservo.write(locked); 

  digitalWrite(13, HIGH);  
  delay(200);             
  digitalWrite(13, LOW);    
  Serial.println("Door locked");
 (trigger = 0);
  }
}

This doesn't work?

#define MY_TAG_CODE "3200A0346D5D"
#define MY_TAG_CODE2 "someothercode"

if(msg.indexOf(MY_TAG_CODE)>=0 || msg.indexOf(MY_TAG_CODE2)>=0)

Ragnar:
This doesn't work?

#define MY_TAG_CODE "3200A0346D5D"
#define MY_TAG_CODE2 "someothercode"

if(msg.indexOf(MY_TAG_CODE)>=0 || msg.indexOf(MY_TAG_CODE2)>=0)

thanks Ragnar, now it works :wink:
I was doing it the wrong way

  if(msg.indexOf(MY_TAG_CODE) || msg.indexOf(MY_TAG_CODE2)>=0)

am newbie indeed :sweat_smile:

You could create a for loop to cycle trough an array of allowed keys. Something like:

int codenum = 5; \\ Amount of codes in your list
char codes[codenum] = {
   'Code1'
   'Code2'
   'Code3'
   'Code4'
   'Code5'
 };

for(int x = 1; x < (codenum+1); x++) { // For loop means for every x to stuff

if(msg.indexOf(codes[x])>=0) {  // So for every x check x's value in the list of codes against incoming code. if match unlock.


break; // Not really nessecary, but it neater. this way the for loop is stopped early if the code is early in the list
}

}

Im not an expert, so feel free to tell me im wrong ^^
Pretty sure this would work fine.