Multiple String Compare Issue

Hey guys, I'm trying to get my Arduino to check for a code and then compare it to the ones i have already programmed.

I've tried the code with only a single compare: if (strcmp(tagcode, str1)==0) and it works, the LED lights up when the correct code is read but stays off when reading different codes. However, when i try to do the 'or' statements it fails. Can anyone see where i went wrong?

Thank you in advance.

char tagcode[17];
int i;
char str1[17]="FF954003CAF55DF8";
char str2[17]="FF954003F7E92592";
char str3[17]="FF954003C6A1A5EC";
char str4[17]="FF954003FA06301C";
char str5[17]="FF954003CB76794A";
char str6[17]="FF954003C6C883C0";
char str7[17]="FF954003C6AC1A82";
char str8[17]="FF954003CAF1B004";
const byte Led1=13;
const byte Led2=12;


void setup()
{
   pinMode(Led1,OUTPUT);
   pinMode(Led2,OUTPUT);
   Serial.begin(9600);
}

void loop() 
{
  
  if(Serial.available() > 0)
  {
   delay(035);
   if(Serial.read() == 'F')
   {
   tagcode[0]='F';

   for(i = 1; i < 17; i++)
   {
     tagcode[i] = Serial.read();
   } 
    tagcode[16]=0;
 
    Serial.print("Information Read: ");
    Serial.println(tagcode);
    
 
   [glow] if (strcmp(tagcode, str1)==0 || strcmp(tagcode, str2)==0 || 
        strcmp(tagcode, str3)==0 || strcmp(tagcode, str4)==0)[/glow]
      {
        digitalWrite(Led1, HIGH);
        delay(2000);
        digitalWrite(Led1, LOW);
      } 
     [glow]else if (strcmp(tagcode, str5)==0 || strcmp(tagcode, str6)==0 || 
        strcmp(tagcode, str7)==0 || strcmp(tagcode, str8)==0)[/glow]
       {
        digitalWrite(Led2, HIGH);
        delay(2000);
        digitalWrite(Led2, LOW);
       } 
   }
 }
}

Try adding more ():

if ((strcmp(tagcode, str1)==0) || (strcmp(tagcode, str2)==0) ||
        (strcmp(tagcode, str3)==0) || (strcmp(tagcode, str4)==0))

Try adding more ():

if ((strcmp(tagcode, str1)==0) || (strcmp(tagcode, str2)==0) ||

(strcmp(tagcode, str3)==0) || (strcmp(tagcode, str4)==0))

I don't think that is the problem, the precedence of == is higher than ||, though the () does make it clearer.

I notice in (with my comments):

   if(Serial.read() == 'F')
   {
   tagcode[0]='F';

   for(i = 1; i < 17; i++)
   {  // put char into tagcode[1] to tagcode[16]
     tagcode[i] = Serial.read(); 
   }
    tagcode[16]=0;  // overwrite tagcode[16] again 
                // after it was added in the for loop

even though the strings are only 16 characters long, the for loop puts a character into tagcode*, where i is 16, and is hence character 17, and then puts 0 into the 17 location.*
This would have the effect of getting out of synch with input, causing the code to skip characters until it finds another F. This is unfortunate because the strings have F in several places, so it can get badly out of synch; I can't see when it will get back into synch.
I think you should change the for loop test to:
for(i = 1; i < 16; i++)
I'd suggest defining a constant:
#define CODE_LENGTH (16)
and base my calculations on using that to make the program a bit easier to follow.
for(i = 1; i < CODE_LENGTH; i++) ...
tagcode[CODE_LENGTH]=0;
I'd also suggest you might want to declare the strings as:
char str1[]="FF954003CAF55DF8";
especially if they are all going to be the same length. The use of 17 in their declarations may have distracted you when reading the code.
To make communications easier to synchronise, can you use a character which isn't 0-9 or A-F in between codes? That way your loop can re-synchronise more easily if things go wrong.
HTH
GB-)