Skip to content

Instantly share code, notes, and snippets.

@esmarr58
Last active October 27, 2017 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esmarr58/4f1fe5c66b2dea5ec86769f18ab6a2b9 to your computer and use it in GitHub Desktop.
Save esmarr58/4f1fe5c66b2dea5ec86769f18ab6a2b9 to your computer and use it in GitHub Desktop.
#include <SPI.h>;
#include <MFRC522.h>;
RFID rfid(10,5);
void setup() {
Serial.begin(9600);
SPI.begin();
rfid.init();
}
unsigned char het[16]={'H','E','T','P','R','O',' ','R','F','I','D',' ','5','5','2',' '}; //Declaracion de cadena de caracteres
unsigned char *writeData=het; //asigna het a char tipo puntero
unsigned char *str; //char tipo puntero utilizado para la función de lectura de un bloque
void loop() {
if (rfid.isCard()) {
rfid.write(8,writeData); //Función escritura (num de bloque, string)
rfid.read(8,str); //Función lectura (num de bloque, str) guarda lo que está en el bloque a str
Serial.print(str[0]); //Imprime lo que se guardó en str de la funcion read
}
rfid.halt();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment