Stop fingerprint reader to stop blinking and wasting energy/ life span

hi
i have some setup with a finger print reader

as long as the arduino is on the finger print reader wont stop blinking.

i need to make it stop blinking until i need to use it
i tried using MOSFET connected to digital pin and the 2 pins connected to the 5 volts and it would crash and not response to finger reading

!schematic && !code == !help.

/*************************************************** 
*  
subscribe for more arduino projects

https://www.youtube.com/channel/UCM6rbuieQBBLFsxszWA85AQ?sub_confirmation=1

Written by Limor Fried/Ladyada for Adafruit Industries.
  
Modified by Akshay Momaya, For Mission Critical




****************************************************/


#include <Adafruit_Fingerprint.h>
#include <SPI.h>
#include <MFRC522.h>

#define ACCESS_DELAY 2000
#define DENIED_DELAY 1000
#define SS_PIN 53
#define t 7
String q="EA 28 B4 1A";
#define RST_PIN 5
MFRC522 mfrc522(SS_PIN, RST_PIN);


#define x 9
#define z 4
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

// On Leonardo/Micro or others with hardware serial, use those! #0 is green wire, #1 is white
// uncomment this line:
// #define mySerial Serial1

// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino  (WHITE wire)
// comment these two lines if using hardware serial
SoftwareSerial mySerial(10, 11);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()  
{
Serial.begin(9600);   
SPI.begin();  
 mfrc522.PCD_Init();   
 lcd.init();                      // initialize the lcd 
lcd.init();
// Print a message to the LCD.
lcd.backlight();

while (!Serial);  // For Yun/Leo/Micro/Zero/...
delay(100);
Serial.println("\n\nAdafruit finger detect test");

// set the data rate for the sensor serial port
finger.begin(57600);

pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(x,OUTPUT);
pinMode(t,OUTPUT);
pinMode(z,OUTPUT);
digitalWrite(z,LOW);
digitalWrite(t,HIGH);
Serial.println("Put your card to the reader...");
Serial.println();


if (finger.verifyPassword()) {
  Serial.println("Found fingerprint sensor!");
} else {
  Serial.println("Did not find fingerprint sensor :(");
  while (1) { delay(1); }
}

finger.getTemplateCount();
Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
Serial.println("Waiting for valid finger...");
}

void loop()                     // run over and over again
{
getFingerprintIDez();
delay(50);   //don't ned to run this at full speed.

digitalWrite(12,HIGH);
if ( ! mfrc522.PICC_IsNewCardPresent()) 
{
  return;
}
// Select one of the cards
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[i] < 0x10 ? " 0" : " ");
   Serial.print(mfrc522.uid.uidByte[i], HEX);
   content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
   content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
if (content.substring(1) == q)
{

  

  
  Serial.println("Authorized access");
  digitalWrite(z,HIGH);
delay(2000);
digitalWrite(z,LOW);
  Serial.println();
 
  
  
 
  delay(ACCESS_DELAY);
   
  
}

else   {
  Serial.println(" Access denied");
  
  
  delay(DENIED_DELAY);
 
  
}
}

uint8_t getFingerprintID() {
uint8_t p = finger.getImage();
switch (p) {
  case FINGERPRINT_OK:
    Serial.println("Image taken");
    break;
  case FINGERPRINT_NOFINGER:
    Serial.println("No finger detected");
    return p;
  case FINGERPRINT_PACKETRECIEVEERR:
    Serial.println("Communication error");
    return p;
  case FINGERPRINT_IMAGEFAIL:
    Serial.println("Imaging error");
    return p;
  default:
    Serial.println("Unknown error");
    return p;
}

// OK success!

p = finger.image2Tz();
switch (p) {
  case FINGERPRINT_OK:
    Serial.println("Image converted");
    break;
  case FINGERPRINT_IMAGEMESS:
    Serial.println("Image too messy");
    return p;
  case FINGERPRINT_PACKETRECIEVEERR:
    Serial.println("Communication error");
    return p;
  case FINGERPRINT_FEATUREFAIL:
    Serial.println("Could not find fingerprint features");
    return p;
  case FINGERPRINT_INVALIDIMAGE:
    Serial.println("Could not find fingerprint features");
    return p;
  default:
    Serial.println("Unknown error");
    return p;
}

// OK converted!
p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK) {


  
  Serial.println("Found a print match!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
  Serial.println("Communication error");
  return p;
} else if (p == FINGERPRINT_NOTFOUND) {
  Serial.println("Did not find a match");
  return p;
} else {
  Serial.println("Unknown error");
  return p;
}   

// found a match!
Serial.print("Found ID #"); Serial.print(finger.fingerID); 
Serial.print(" with confidence of "); Serial.println(finger.confidence); 

return finger.fingerID;
}

// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK)  return -1;
 lcd.print("what m8");
 delay(800);
 lcd.clear();

p = finger.image2Tz();
if (p != FINGERPRINT_OK)  return -1;

p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK)  return -1;
lcd.print("welcome !");
 lcd.setCursor(0,1);
lcd.print("door unlocked!");
digitalWrite(x,HIGH);
digitalWrite(z,HIGH);
delay(2000);
digitalWrite(z,LOW);
digitalWrite(x,LOW);
lcd.setCursor(0,0);

delay(2000);
lcd.clear();

// found a match!
Serial.print("Found ID #"); Serial.print(finger.fingerID); 
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID; 
}[code]

It's because of the italics in your code :smiley: Please read How to use this forum - please read. - Installation & Troubleshooting - Arduino Forum and pay special attention to point #7 about posting code. Next edit reply #2 and add the code tags.

We're still missing your wiring diagram / schematic :wink:

Give pins decent names; 12 and 13 don't mean anything so we have no idea what you're trying to do with them.

sterretje:
It's because of the italics in your code :smiley: Please read How to use this forum - please read. - Installation & Troubleshooting - Arduino Forum and pay special attention to point #7 about posting code. Next edit reply #2 and add the code tags.

We're still missing your wiring diagram / schematic :wink:

Give pins decent names; 12 and 13 don't mean anything so we have no idea what you're trying to do with them.

i will try to draw the diagram. thanks alot man