#include <SPI.h>           // SPI library
#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN         5          // Configurable, see typical pin layout above
#define SS_PIN          10         // Configurable, see typical pin layout above

String tagID = "";
byte readCard[4];
uint8_t result;

MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance

int pushButton = 14;
int buttonState = HIGH;


void setup()
{
  pinMode(pushButton, INPUT);
  Serial.begin(115200);    // Initialize serial communications with the PC
  SPI.begin();      // Init SPI bus
  mfrc522.PCD_Init();   // Init MFRC522
  mfrc522.PCD_DumpVersionToSerial();  // Show details of PCD - MFRC522 Card Reader details
  Serial.println("hello");
}

void loop()
{
  //Serial.println("begin");
  if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial())
  {
    tagID = "";
    for ( uint8_t i = 0; i < 4; i++) // The MIFARE PICCs that we use have 4 byte UID
    {
      readCard[i] = mfrc522.uid.uidByte[i];
      tagID.concat(String(mfrc522.uid.uidByte[i], HEX)); // Adds the 4 bytes in a single String variable
    }
    //Serial.println(tagID);
    //card 1
    if (tagID == "6f4fe128")
    {
      Serial.println("card1");
    }

    //card 2
    if (tagID == "fa17e759")
    {
      Serial.println("card2");
    }

    //card 3
    if (tagID == "fa22e659")
    {
      Serial.println("card3");
    }

    //card 4
    if (tagID == "b232e759")
    {
      Serial.println("card4");
    }

//card 5
       if (tagID == "cf64e659")
    {
      Serial.println("card5");
    }

//card 6
       if (tagID == "c582e659")
    {
      Serial.println("card6");
    }

//card 7
       if (tagID == "985ce659")
    {
      Serial.println("card7");
    }

//card 8
       if (tagID == "758efe29")
    {
      Serial.println("card8");
    }

//card 9
       if (tagID == "3063fe29")
    {
      Serial.println("card9");
    }

//card 10
       if (tagID == "eb3ce659")
    {
      Serial.println("card10");
    }

//card 11
       if (tagID == "e735e759")
    {
      Serial.println("card11");
    }

  }
}
