Last active
October 27, 2017 03:30
-
-
Save esmarr58/4f1fe5c66b2dea5ec86769f18ab6a2b9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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