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.
main.cpp
00001 00002 #include "mbed.h" 00003 #include "MFRC522.h" 00004 00005 00006 #define SPI_MOSI D4 00007 #define SPI_MISO D5 00008 #define SPI_SCLK D6//SCK 00009 #define SPI_CS D3//SDA 00010 // KL25Z Pin for MFRC522 reset 00011 #define MF_RESET D2//Rst pini 00012 00013 MFRC522 RfChip (SPI_MOSI, SPI_MISO, SPI_SCLK, SPI_CS, MF_RESET); 00014 00015 int main(void) { 00016 00017 00018 // Init. RC522 Chip 00019 RfChip.PCD_Init(); 00020 00021 while (true) { 00022 00023 00024 // Look for new cards 00025 if ( ! RfChip.PICC_IsNewCardPresent()) 00026 { 00027 wait_ms(500); 00028 continue; 00029 } 00030 00031 00032 // Select one of the cards 00033 if ( ! RfChip.PICC_ReadCardSerial()) 00034 { 00035 wait_ms(500); 00036 continue; 00037 } 00038 00039 // Print Card UID 00040 printf("Card UID: "); 00041 for (uint8_t i = 0; i < RfChip.uid.size; i++) 00042 { 00043 printf(" %X ", RfChip.uid.uidByte[i]);//Hex kodunu verir 00044 } 00045 printf("\n\r"); 00046 00047 // Print Card type 00048 uint8_t piccType = RfChip.PICC_GetType(RfChip.uid.sak); 00049 printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType)); 00050 } 00051 }
Generated on Fri Jul 22 2022 04:20:01 by
1.7.2