RFID Door Lock

hey guys im hoping someone out there has some experience in RFID tech.
im using an Arduino Duemilanove wired to a Parallax Read Only RFID Scanner.

im attempting to get the scanned card to compare with the array of accepted cards but this dam error keeps coming up and im not knowledgeable enough yet to discover where ive gone wrong.

error: cannot convert 'String' to 'const char*' for argument '2' to 'int strcmp(const char*, const char*)'

#include <SoftwareSerial.h>

#define RFIDEnablePin 2
#define LEDEnablePin 3
#define RFIDSerialRate 2400

#define RxPin 5
#define TxPin 4
SoftwareSerial RFIDScan(RxPin,TxPin);

int i;

char* tagStrings[]= {"03003C4D73", "03006FFAC4"};

String RFIDTag="";
String PreviousTag = "";

void setup()
{
  
  RFIDScan.begin(RFIDSerialRate);
  
  pinMode(RFIDEnablePin,OUTPUT);
  
  digitalWrite(RFIDEnablePin, LOW);
  
  Serial.begin(2400);
  
  Serial.println("Please Scan Your Card...");
  
}

void loop()
{
  if(RFIDScan.available()>0)
    {
      ReadSerial(RFIDTag);
    }

  if(PreviousTag!=RFIDTag)
    {
      PreviousTag=RFIDTag;
      
      for(i=0;i<2;i++)
   {
   Serial.print(tagStrings[i]);
   Serial.print(" - ");
   Serial.println(RFIDTag);
   if (strcmp(tagStrings[i], RFIDTag) == 0) { // <<< ERROR HERE
      Serial.println("Matched");
      break;
     }  
    }
   }
 delay( 500 );
}

void ReadSerial(String &ReadTagString)
{
  int bytes = 0;
  int val = 0;
  char code[11];
  String TagData="";
  
  if(RFIDScan.available() > 0) {
    if((val = RFIDScan.read()) == 10) {
      bytes = 0;
      while(bytes<10) {
        if(RFIDScan.available() > 0) {
          val = RFIDScan.read();
          if((val == 10)||(val == 13)) {
            code[bytes++] = '\0';
            break;
          }
          code[bytes] = val;
          bytes++;
        }
      }
      
     if(bytes == 10) {
       
       for(int x=0;x<10;x++)
       {
         TagData += code[x];
       }
       ReadTagString = TagData;
       while(RFIDScan.available() > 0)
       {
         RFIDScan.read();
       }
     }
     
    
     bytes = 0;
     TagData="";

        digitalWrite(LEDEnablePin, HIGH);   
        delay(1000);               // wait for a second
        digitalWrite(LEDEnablePin, LOW);
      
    } 
  } 
  
}

any help with this issue would be greatly appreciated. id like to get this operational ASAP :smiley:

cheers,

Rob

it seems the returning value from the reading of the frid is a string, and not a char* as you want it to be.

isn't there a way to read something like readBytes()? that way you have chars instead of a string, which will be easier to compare..

if not, you'll have to convert your string into a char*

Don't use the String class, it fragments your memory very fast and even has some implementation errors. If you search on the forum for the String class you'll get lots of examples what the results of using this class may be.

Rewrite your sketch to use only character arrays.

if not, you'll have to convert your string into a char*

Which you can do using the toCharArray() method, just to test.

But, pylon's right. You really don't want to be using the String class.