SHARE
TWEET

Untitled

a guest Aug 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <SPI.h>
  2. #include <MFRC522.h>
  3. #define pinSDA 10
  4. #define pinRST 9
  5. MFRC522 RFID(pinSDA, pinRST);
  6. void setup() {
  7.   Serial.begin(9600);
  8.   SPI.begin();
  9.   RFID.PCD_Init();
  10.   Serial.println("");
  11.   Serial.println("Tap Kartu/Gantungan !");
  12.   Serial.println();
  13. }
  14. void loop() {
  15.   if ( ! RFID.PICC_IsNewCardPresent()) {
  16.     return;
  17.   }
  18.   if ( ! RFID.PICC_ReadCardSerial()) {
  19.     return;
  20.   }
  21.   Serial.print("ID Tag :");
  22.   String content = "";
  23.   byte letter;
  24.   for (byte i = 0; i < RFID.uid.size; i++) {
  25.     Serial.print(RFID.uid.uidByte[i] < 0x10 ? " 0" : " ");
  26.     Serial.print(RFID.uid.uidByte[i], HEX);
  27.     content.concat(String(RFID.uid.uidByte[i] < 0x10 ? " 0" : " "));
  28.     content.concat(String(RFID.uid.uidByte[i], HEX));
  29.   }
  30.   Serial.println();
  31.   delay(2500);
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top