Skip to content

Instantly share code, notes, and snippets.

@esmarr58 esmarr58/rc522.ino
Created Oct 27, 2017

Embed
What would you like to do?
rc522.ino
#include <SPI.h>;
#include <MFRC522.h>;
RFID rfid(10,5);
void setup() {
Serial.begin(9600); //Inicializa la velocidad de Serial
SPI.begin(); //Función que inicializa SPI
rfid.init(); //Función que inicializa RFID
}
void loop() {
if (rfid.isCard()) { //Verifica si hay una tarjeta
if (rfid.readCardSerial()) { //Funcion que lee la tarjeta
Serial.println(" ");
Serial.println(" ");
Serial.println("El numero de serie de la tarjeta es : ");
for(int i=0;i<=4; i++){
if(i!=4){
Serial.print(rfid.serNum[i],HEX); //rfid.serNum lee el número de serie unico de la tarjeta
Serial.print(" ");
}
else{
Serial.print(rfid.serNum[i],HEX);
Serial.print(" ");
}
}
delay(1000);
}
}
rfid.halt();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.