Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed MFRC522 TextLCD
main.cpp
00001 #include "mbed.h" 00002 #include "MFRC522.h" 00003 #define MF_RESET D7 00004 #include "TextLCD.h" 00005 00006 TextLCD lcd(PB_4, PB_10, PA_8, PB_5, PB_3, PA_10, TextLCD::LCD16x2); // rs, e, d4-d7 00007 00008 DigitalOut led(LED1); 00009 Serial PC(USBTX,USBRX); 00010 MFRC522 NFC(PB_15,PB_14,PB_13,PB_12,MF_RESET); 00011 //variables 00012 uint8_t erick[4]={0x9B,0xD9,0xA0,0x49}; 00013 uint8_t landeros[4]={0xCD,0xE1,0x42,0xED}; 00014 uint8_t nicolas[4]={0x3D,0xDA,0x3D,0xED}; 00015 uint8_t andres[4]={0xED,0x65,0xD4,0x28}; 00016 uint8_t mateo[4]={0xD,0xC6,0xCD,0x28}; 00017 uint8_t id1[4]={0xBB,0xCC,0xE2,0x2B}; 00018 uint8_t act[4]; 00019 00020 bool comparar(uint8_t array1[], uint8_t array2[]){ 00021 if(array1[0] != array2[0])return(false); 00022 if(array1[1] != array2[1])return(false); 00023 if(array1[2] != array2[2])return(false); 00024 if(array1[3] != array2[3])return(false); 00025 return(true); 00026 } 00027 00028 int main(void) { 00029 PC.printf("starting...\n"); 00030 NFC.PCD_Init(); 00031 00032 while (1) { 00033 00034 if ( ! NFC.PICC_IsNewCardPresent()) 00035 { 00036 wait_ms(500); 00037 } 00038 if ( ! NFC.PICC_ReadCardSerial()) 00039 { 00040 wait_ms(500); 00041 } 00042 //PC.printf("Card UID: "); 00043 for (uint8_t i = 0; i < NFC.uid.size; i++) 00044 { 00045 // PC.printf("%X02 \n",NFC.uid.uidByte[i]); 00046 act[i] = NFC.uid.uidByte[i]; 00047 00048 } 00049 //PC.printf("\n\r"); 00050 //lcd.printf("ola k ase"); 00051 lcd.cls(); 00052 lcd.locate(0,0); 00053 if(comparar(act,erick)){lcd.printf("Erick ");} 00054 else if(comparar(act,landeros)){lcd.printf("Landeros");} 00055 else if(comparar(act,nicolas)){lcd.printf("Nicolas");} 00056 else if(comparar(act,andres)){lcd.printf("Andres");} 00057 else if(comparar(act,mateo)){lcd.printf("Mateo");} 00058 else if(comparar(act,id1)){lcd.printf("putooos");} 00059 } 00060 } 00061 00062
Generated on Wed Jul 20 2022 01:09:03 by
1.7.2