try to implement rfid

This commit is contained in:
Siegfried Kienzle
2017-06-14 09:44:53 +02:00
parent c92e91d760
commit f9282ad540
3 changed files with 1482 additions and 0 deletions

30
project/rfid/rfid.c Normal file
View File

@@ -0,0 +1,30 @@
#include <unistd.h>
#include "MFRC522.h"
int main()
{
MFRC522 mfrc;
mfrc.PCD_Init();
while(1)
{
if(!mfrc.PICC_IsNewCardPresent())
continue;
if(!mfrc.PICC_ReadCardSerial())
continue;
for(byte i = 0; i < mfrc.uid.size; ++i){
if(mfrc.uid.uidByte[i] < 0x10){
printf(" 0");
printf("%X",mfrc.uid.uidByte[i]);
} else {
printf(" ");
printf("%X", mfrc.uid.uidByte[i]);
}
}
printf("\n");
usleep(1000*1000);
}
return 0;
}