Help fo RFID 522 module

hi,
I try to make power cut circuit by RFID module working only if IFRD card still put on module, (by make Pin 5 High)
How to get code to make pin 5 low when remove the card or tag from RFID module

SoftwareSerial mySerial(2, 3);

#include <Wire.h>

#include <SoftwareSerial.h>
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 8
#define Unlock 5

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

void setup()
{
while (!Serial);
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522

pinMode(Unlock, OUTPUT);
digitalWrite(Unlock,HIGH);

lcd.begin();

void loop()
{

if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}

if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}

Serial.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte < 0x10 ? " 0" : " ");
_ Serial.print(mfrc522.uid.uidByte*, HEX);_
_ content.concat(String(mfrc522.uid.uidByte < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte, HEX));
}
Serial.println();*_

* content.toUpperCase();*

if ((content.substring(1) == "D2 D8 66 A3")||(content.substring(1) == "76 1D 62 A3")||(content.substring(1) == "71 C5 7D 83")||(content.substring(1) == "56 F2 7D 83")||(content.substring(1) == "D3 0D 72 91")||(content.substring(1) == "FA DD C3 CE")) //change here the UID of the card/cards that you want to give access
* {*
* digitalWrite(Unlock,LOW);*

}

}

I try to make power cut circuit by RFID module working only if IFRD card still put on module, (by make Pin 5 High)
How to get code to make pin 5 low when take away the card or tag from RFID module

SoftwareSerial mySerial(2, 3);

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3f, 16, 2);
#include <SoftwareSerial.h>
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 8
#define Unlock 5

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

void setup()
{
while (!Serial);
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522

pinMode(Unlock, OUTPUT);
digitalWrite(Unlock,HIGH);

lcd.begin();

void loop()
{

if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte < 0x10 ? " 0" : " ");
_ Serial.print(mfrc522.uid.uidByte*, HEX);_
_ content.concat(String(mfrc522.uid.uidByte < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte, HEX));
}
Serial.println();*_

* content.toUpperCase();*
* if ((content.substring(1) == "D2 D8 66 A3")||(content.substring(1) == "76 1D 62 A3")||(content.substring(1) == "71 C5 7D 83")||(content.substring(1) == "56 F2 7D 83")||(content.substring(1) == "D3 0D 72 91")||(content.substring(1) == "FA DD C3 CE")) //change here the UID of the card/cards that you want to give access*
* {*
* digitalWrite(Unlock,LOW);*

}

}

Do not double post.

Please use code tags when posting code, as described in "How to use this forum". Do not double post.

jremington:
Do not double post.

sorry i try to post as question put can not delet the original

How to get code to make pin 5 low when take away the card or tag from RFID module

Look at what happens in loop().

  if ( ! mfrc522.PICC_IsNewCardPresent())
  {
    return;
  }

You need to look at what that function does, to determine when a card was removed and replaced. It knows that the card it is now reading is, or is not, the same as the one it was giving data for the last time you asked.

PaulS:
Look at what happens in loop().

  if ( ! mfrc522.PICC_IsNewCardPresent())

{
    return;
  }



You need to look at what that function does, to determine when a card was removed and replaced. It knows that the card it is now reading is, or is not, the same as the one it was giving data for the last time you asked.

the function is stop read from card if card take away , hwo to add this cass code when the card take away

What do those if statements in the beginning of loop() do? Maybe you can do something there?

sterretje:
What do those if statements in the beginning of loop() do? Maybe you can do something there?

i want code in case stop read from card if card take away to do some thing by (if condition) like

if ( " case serial stop read ")
{

digitalWrite(Unlock,HIGH);

}