![](/media/cache/group/mehmet_akif_arvas.jpg.50x50_q85.jpg)
kapi guvenlik uygulamasi(RFID,KEypad,LCD,BUZZER,ROLE)
Dependencies: mbed MFRC522 TextLCD keypad
Diff: main.cpp
- Revision:
- 3:e22883906b56
- Parent:
- 2:961790ab9dbb
--- a/main.cpp Sun Dec 15 07:03:21 2019 +0000 +++ b/main.cpp Sun Dec 15 07:38:26 2019 +0000 @@ -4,6 +4,7 @@ #include <iostream> #include "MFRC522.h" +Serial pc(USBTX,USBRX); //KL25Z Pins for MFRC522 SPI interface #define SPI_MOSI PA_7 //Master output slave input #define SPI_MISO PA_6 //Master input slave Output @@ -53,11 +54,12 @@ } } - lcd.cls() + lcd.cls(); } int main() { + pc.baud(9600); // Init. RC522 Chip RfChip.PCD_Init(); uint32_t key_num; @@ -90,8 +92,8 @@ }// while ((key_num = key.read()) != 0) { // Look for new cards - if ( ! RfChip.PICC_IsNewCardPresent()) { - wait_ms(100); + if (RfChip.PICC_IsNewCardPresent()) { + wait_ms(10); continue; } @@ -99,16 +101,16 @@ // Select one of the cards if ( ! RfChip.PICC_ReadCardSerial()) { - wait_ms(100); + wait_ms(10); continue; } // Print Card UID printf("Kart ID: "); for (uint8_t i = 0; i < RfChip.uid.size; i++) { - printf(" %X", RfChip.uid.uidByte[i]); + pc.printf(" %X", RfChip.uid.uidByte[i]); } - printf("\n"); + pc.printf("\n"); //kendi kartınızı id'si olacak if(RfChip.uid.uidByte[0]==0x76 && RfChip.uid.uidByte[1]==0x45 && RfChip.uid.uidByte[2]==0x55 && RfChip.uid.uidByte[3]==0xF5) { @@ -126,9 +128,9 @@ // Print Card type uint8_t piccType = RfChip.PICC_GetType(RfChip.uid.sak); - printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType)); + pc.printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType)); }// while(true) { - return 0; + }//main \ No newline at end of file