MFRC522 RFID READ CODE

RFID MFRC522

#include <SPI.h>

#include <MFRC522.h>

#define RST_PIN 9

#define SS_PIN 10

MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup() {

Serial.begin(9600);

while (!Serial);

SPI.begin();

mfrc522.PCD_Init();

mfrc522.PCD_DumpVersionToSerial();

Serial.println(F(“Scan PICC to see UID, SAK, type, and data blocks…”));

}

void loop() {

// Look for new cards

if ( ! mfrc522.PICC_IsNewCardPresent()) {

return;

}

// Select one of the cards

if ( ! mfrc522.PICC_ReadCardSerial()) {

return;

}

// Dump debug info about the card; PICC_HaltA() is automatically called

mfrc522.PICC_DumpToSerial(&(mfrc522.uid));

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s