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 ![]()
cheers,
Rob