Marvas / Mbed 2 deprecated rfid_kart_okuma

Dependencies:   mbed MFRC522 TextLCD

Revision:
0:cc98cfec2221
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Dec 11 12:19:16 2019 +0000
@@ -0,0 +1,57 @@
+//rfid ve lcd ekran kullanimi
+
+#include "mbed.h"
+#include "TextLCD.h"
+#include <iostream>
+ #include "MFRC522.h"
+Serial seriport(USBTX,USBRX);
+TextLCD lcd(PB_0,PA_4,PC_3,PC_2,PB_3,PA_10);
+
+
+ //KL25Z Pins for MFRC522 SPI interface
+ #define SPI_MOSI    PA_7 //Master output slave input
+ #define SPI_MISO    PA_6  //Master input slave Output
+ #define SPI_SCLK    PA_5 //SCK Clock pulse saat darbesi
+ #define SPI_CS      PB_6 //SDA data pini
+ // KL25Z Pin for MFRC522 reset
+ #define MF_RESET    PC_7 //RST
+
+ MFRC522  RfChip(SPI_MOSI, SPI_MISO, SPI_SCLK, SPI_CS, MF_RESET);
+
+ int main(void) {
+
+   // Init. RC522 Chip
+   RfChip.PCD_Init();
+
+   while (true) {
+
+
+     // Look for new cards
+     if ( ! RfChip.PICC_IsNewCardPresent())
+     {
+       wait_ms(100);
+       continue;
+     }
+
+
+
+     // Select one of the cards
+     if ( ! RfChip.PICC_ReadCardSerial())
+     {
+       wait_ms(100);
+       continue;
+     }
+
+     // Print Card UID
+     printf("Kart ID: ");
+     for (uint8_t i = 0; i < RfChip.uid.size; i++)
+     {
+       printf(" %X", RfChip.uid.uidByte[i]);
+     }
+     printf("\n");
+
+     // Print Card type
+     uint8_t piccType = RfChip.PICC_GetType(RfChip.uid.sak);
+     printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType));
+   }
+ }
\ No newline at end of file