0% found this document useful (0 votes)
2 views1 page

RFID Access Control Code Example

Uploaded by

ot7sakshi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

RFID Access Control Code Example

Uploaded by

ot7sakshi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

RFID Access Control - Shortened Code

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

MFRC522 rfid(10, 9);


LiquidCrystal lcd(12, 11, A0, A1, A2, A3);
byte myUID[4] = {0x53, 0xD9, 0x47, 0x16};

void setup() {
pinMode(3, OUTPUT); pinMode(4, OUTPUT);
[Link](16, 2); [Link](); rfid.PCD_Init(); [Link](9600);
[Link]("Scan your card");
}

void loop() {
if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) return;
bool match = true;
for (byte i = 0; i < 4; i++) if ([Link][i] != myUID[i]) match = false;

[Link]();
if (match) {
[Link]("Welcome bhava!"); [Link](0,1); [Link]("Access granted");
[Link]("Access granted");
digitalWrite(3, HIGH); delay(1000); digitalWrite(3, LOW);
} else {
[Link]("Card not found"); [Link](0,1); [Link]("Access denied");
[Link]("Access denied");
digitalWrite(4, HIGH); delay(1500); digitalWrite(4, LOW);
}

rfid.PICC_HaltA(); rfid.PCD_StopCrypto1(); delay(1500);


[Link](); [Link]("Scan your card");
}

You might also like