uso del modulo rfid con la biblioteca mfrc522
Dependencies: mbed MFRC522 TextLCD
Revision 1:df229dd166ac, committed 2018-11-22
- Comitter:
- Esbp10
- Date:
- Thu Nov 22 01:12:03 2018 +0000
- Parent:
- 0:e31e0aca2b9d
- Commit message:
- LCD con nfc;
Changed in this revision
| TextLCD.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Thu Nov 22 01:12:03 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- a/main.cpp Mon Nov 19 21:01:54 2018 +0000
+++ b/main.cpp Thu Nov 22 01:12:03 2018 +0000
@@ -1,13 +1,20 @@
#include "mbed.h"
#include "MFRC522.h"
-#define MF_RESET D8
+#define MF_RESET D7
+#include "TextLCD.h"
+
+TextLCD lcd(PB_4, PB_10, PA_8, PB_5, PB_3, PA_10, TextLCD::LCD16x2); // rs, e, d4-d7
DigitalOut led(LED1);
Serial PC(USBTX,USBRX);
MFRC522 NFC(PB_15,PB_14,PB_13,PB_12,MF_RESET);
//variables
-uint8_t id1[4]={0x0,0xB7,0x5E,0x7A};
-uint8_t id2[4]={0xBB,0xCC,0xE2,0x2B};
+uint8_t erick[4]={0x9B,0xD9,0xA0,0x49};
+uint8_t landeros[4]={0xCD,0xE1,0x42,0xED};
+uint8_t nicolas[4]={0x3D,0xDA,0x3D,0xED};
+uint8_t andres[4]={0xED,0x65,0xD4,0x28};
+uint8_t mateo[4]={0xD,0xC6,0xCD,0x28};
+uint8_t id1[4]={0xBB,0xCC,0xE2,0x2B};
uint8_t act[4];
bool comparar(uint8_t array1[], uint8_t array2[]){
@@ -32,18 +39,23 @@
{
wait_ms(500);
}
- PC.printf("Card UID: ");
+ //PC.printf("Card UID: ");
for (uint8_t i = 0; i < NFC.uid.size; i++)
{
- PC.printf("%X02 \n",NFC.uid.uidByte[i]);
+ // PC.printf("%X02 \n",NFC.uid.uidByte[i]);
act[i] = NFC.uid.uidByte[i];
}
- PC.printf("\n\r");
-
-if(comparar(act,id1)){PC.printf("puto mateo \n ");}
-else if(comparar(act,id2)){PC.printf("puto landeros \n");}
-
+ //PC.printf("\n\r");
+ //lcd.printf("ola k ase");
+ lcd.cls();
+ lcd.locate(0,0);
+if(comparar(act,erick)){lcd.printf("Erick ");}
+else if(comparar(act,landeros)){lcd.printf("Landeros");}
+else if(comparar(act,nicolas)){lcd.printf("Nicolas");}
+else if(comparar(act,andres)){lcd.printf("Andres");}
+else if(comparar(act,mateo)){lcd.printf("Mateo");}
+else if(comparar(act,id1)){lcd.printf("putooos");}
}
}