Hello guys!
I just made this project for some home door unlock system.
https://create.arduino.cc/projecthub/Techinc1510/rfid-reader-with-lcd-1602-6cbb1e
How can I add more Tag's on this sketch ?
Thank you very much!
PS: It works very well but only with one tag.
//All Credit Technic 1510
//
//
//
//
#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);
LiquidCrystal lcd(6 , 7, 5, 4, 3, 2);
void setup()
{
SPI.begin();
mfrc522.PCD_Init();
lcd.begin(16, 2);
lcd.print("Scan RFID Card");
}
void loop()
{
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
lcd.clear();
lcd.begin(16, 2);
lcd.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
lcd.setCursor(0, 1);
lcd.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
lcd.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
lcd.clear();
lcd.begin(16, 2);
lcd.print("Your level is ");
content.toUpperCase();
if (content.substring(1) == "A4 F2 5A EC") //Plz change to your cards UID
{
lcd.setCursor(0,1);
lcd.print("Access Granted ");
delay(3000);
lcd.clear();
setup();
}
else {
lcd.setCursor(0, 1);
lcd.print(" Access Denied");
delay(3000);
lcd.clear();
setup();
}
}