I have a system where an RFID tag can be checked and Its individual 4byte UID will be printed. My task is to check if subsequent tags have the same UID and if not, print “access denied”. I'm assuming i need to use const char
but I'm not sure. I get an error at if (myrfid.serNum[i] == ID)
saying comparison between pointers and integers are forbidden.
Any sort of clarity would be appreciated, thanks!
(Code is only a section from the for loop)
void loop()
{
int i;
const char ID[] = "111 11 11 11";
cardpresent = myrfid.isCard();
if (cardpresent && ! lastcardpresent)
{
if (myrfid.readCardSerial())
{
for (i = 0; i < 4; i++)
{
if (myrfid.serNum[i] == ID)
{
Serial.print("Acess granted ");
}
else
{
Serial.print("Acess not granted ");
}
}
}
Serial.printf("%3d ", myrfid.serNum[i]);
}
Serial.print("\n");
// ...
}