Arcade swipe card thing with arduino and rfid

#include <Servo.h>
#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);

 int led1=6;
 int led2=7;
 
#define RST_PIN 9
#define SS_PIN 10
 
byte readCard[4];
String MasterTag = "2717277B";
String MasterTag2 = "6772397B";// REPLACE this Tag ID with your Tag ID!!!
String tagID = "";
 
// Create instances
MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup() 
{
  lcd.init();
  lcd.backlight();
  SPI.begin(); // SPI bus
  mfrc522.PCD_Init(); // MFRC522
   pinMode(led1,OUTPUT);
   pinMode(led2,OUTPUT);
 
  lcd.clear();
  lcd.print(" Access Control ");
  lcd.setCursor(0, 1);
  lcd.print("Scan Your Card>>");
}
 
void loop() 
{

    MFRC522::MIFARE_Key key;
  for (byte i = 0; i < 6; i++) key.keyByte[i] = 0xFF;

  //some variables we need
  byte block;
  byte len;
  MFRC522::StatusCode status; 
  
    Serial.begin(9600);
  //Wait until new tag is available
  while (getID()) 
  {
    lcd.clear();
    lcd.setCursor(0, 0);
     
    if (tagID == MasterTag) 
    {
            
      lcd.print(" Access Granted!");
       digitalWrite(led1,HIGH); 
       digitalWrite(led2,LOW);
       
      // You can write any code here like opening doors, switching on a relay, lighting up an LED, or anything else you can think of.
    }
    else
    {
       digitalWrite(led2,HIGH); 
       digitalWrite(led1,LOW);  
      lcd.print(" Access Denied!");
       
    }
     
      lcd.setCursor(0, 1);
      lcd.print(" ID : ");
      lcd.print(tagID);
       
    delay(2000);
     digitalWrite(led2,LOW); 
     digitalWrite(led1,LOW);
    lcd.clear();
    lcd.print(" Access Control ");
    lcd.setCursor(0, 1);
    lcd.print("Scan Your Card>>");
  }
}
 
//Read new tag if available
boolean getID() 
{
   MFRC522::MIFARE_Key key;
  for (byte i = 0; i < 6; i++) key.keyByte[i] = 0xFF;

  //some variables we need
  byte block;
  byte len;
  MFRC522::StatusCode status; 
  
  // Getting ready for Reading PICCs
  if ( ! mfrc522.PICC_IsNewCardPresent()) { //If a new PICC placed to RFID reader continue
  return false;
  }
  if ( ! mfrc522.PICC_ReadCardSerial()) { //Since a PICC placed get Serial and continue
  return false;
  }

    byte buffer1[18];

  block = 4;
  len = 18;

  status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 4, &key, &(mfrc522.uid)); //line 834 of MFRC522.cpp file
  if (status != MFRC522::STATUS_OK) {
    Serial.print(F("Authentication failed: "));
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }

  status = mfrc522.MIFARE_Read(block, buffer1, &len);
  if (status != MFRC522::STATUS_OK) {
    Serial.print(F("Reading failed: "));
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }
  tagID = "";
 for (uint8_t i = 0; i < 16; i++)
  {
    if (buffer1[i] != 32)
    {
      Serial.write(buffer1[i]);
      tagID.concat(char(buffer1[i]));
    }
  }
  Serial.print(" ");
  tagID.toUpperCase();
 mfrc522.PICC_HaltA();
  mfrc522.PCD_StopCrypto1();
  return true;
}

OKAY!!! I figured something out, I managed to work out how to read the tag and display it!
Now I need to figure out how to write to it..

OK, so don't complain when it "mysteriously" completely stops working because you are applying the wrong voltages to the RFID reader. :face_with_raised_eyebrow:

the reader only says 3.3v

Why ask if the circuit is OK when you do not want to here the answer?
The fact that it functions at the moment does not mean it is OK. The reader is likely to fail a lot sooner with the over voltage on the input.

Not much point in advising you about the software then as you have shown a reluctance about taking my advice on the hardware.

That is only the power supply to the reader chip. Why not look at the data sheet for that chip and see what that says.

But you have marked the thread solved. Do not start a new one, it is against the rules here.

Indeed it does!

So connecting 5 V logic from an Arduino UNO to it is clearly not a good idea! :astonished:

Okay, I know that and I have connected it properly to the 3.3v pin!!!!

Now would someone please help me with the code please!

Are you not paying attention? We are not talking about the 3.3V pin. We are talking about the signals that the Arduino sends at 5V into that reader.

As I said I won't because it is a waste of time, because you are reluctant to get your hardware right so software is irrelevant as far as I am concerned.

Maybe some one else is willing to help you.

Okay fine, I have done the hardware connections
Now please can you help me with the softwar