rfid module code

I'm working with the RC522 module.

I am using it to toggle a LED but although it detects the card I cant get the IF loop to work that should show the serial number....

/*
PINOUT:
RC522 MODULE    Uno/Nano     MEGA
SDA             D10          D9
SCK             D13          D52
MOSI            D11          D51
MISO            D12          D50
IRQ             N/A          N/A
GND             GND          GND
RST             D9           D8
3.3V            3.3V         3.3V
*/
/* Include the standard Arduino SPI library */
#include <SPI.h>
/* Include the RFID library */
#include <RFID.h>


/* Define the DIO used for the SDA (SS) and RST (reset) pins. */
#define SDA_DIO 53
#define RESET_DIO 5
/* Create an instance of the RFID library */
RFID RC522(SDA_DIO, RESET_DIO); 
int powerPin =2;
int powerpinRead;
int prevpowerpinRead = LOW;
int powerpinState = LOW;
long time = 0;         // the last time the output pin was toggled
long debounce = 200;   // the debounce time, increase if the output flickers


void setup()
{ 
  Serial.begin(9600);
  /* Enable the SPI interface */
  SPI.begin(); 
  /* Initialise the RFID reader */
  RC522.init();
  pinMode(powerPin, OUTPUT); 
}

void loop()
{
 powerpinRead =RC522.isCard();
 Serial.println (powerpinRead);

if (powerpinRead == HIGH && prevpowerpinRead == LOW && millis() - time > debounce) 
{
    if (powerpinState == HIGH)
    powerpinState = LOW;
    else
    powerpinState = HIGH;

    time = millis();    
}

  digitalWrite(powerPin, powerpinState);

  prevpowerpinRead = powerpinRead;
 
  /* Has a card been detected? */
  if (RC522.isCard())
  {
    /* If so then get its serial number */
    RC522.readCardSerial();
    Serial.println("Hello kevin");
     for(int i=0;i<5;i++)
    {
    Serial.print(RC522.serNum[i],DEC);
    //Serial.print(RC522.serNum[i],HEX); //to print card detail in Hexa Decimal format
    }
    Serial.println();
    Serial.println();
  }
 
  delay(500);
}

Hello Kevin
Maybe the reader is not recognized by the Arduino. What does these lines print on the serial console?

 powerpinRead =RC522.isCard();
 Serial.println (powerpinRead);

What Arduino board are you using? Is it a Mega?
You have some pin information at the beginning of your code

/*
PINOUT:
RC522 MODULE    Uno/Nano     MEGA
SDA             D10          D9
SCK             D13          D52
MOSI            D11          D51
MISO            D12          D50
IRQ             N/A          N/A
GND             GND          GND
RST             D9           D8
3.3V            3.3V         3.3V
*/

But you use other pins:

#define SDA_DIO 53
#define RESET_DIO 5
/* Create an instance of the RFID library */
RFID RC522(SDA_DIO, RESET_DIO);

Maybe these pins are not suited for the reader? I can't tell because I dont have this device.
Try to add this line before the delay :

  else Serial.println("Card NOT detected:");

Also, powerpinRead should be declared as a boolean, but I don't think it's the problem.

Its a Mega and the code

 powerpinRead =RC522.isCard();
 Serial.println (powerpinRead);

Prints a 1 if the tab is in range.

The code recognises the tab and toggles the led but it wont run the IF to get the serial number....

I cant get the IF loop to work

The if STATEMENT does NOT loop.

What do you see on the Serial Monitor app (or whatever app is on the other end of the serial port)?

Paul
Bad wording, The IF statement that is supposed to get the serial number isn't running. I know the tab is in range because my serial.print shows a 1 as the card is read and the LED goes on but the serial number doesn't display on the monitor.

Add this line before the delay :
else Serial.println("Card NOT detected:");and paste in your answer, as Paul asked, whatever is on the serial monitor.