| Частота | 125 кГц или 13,56 МГц |
| Диапазон чтения | до 10 см |
| Интерфейс | SPI |
| Напряжение питания | 5 В |
| Ток потребления | 13 мА |
| Температурный диапазон | -20...+70 °C |
VCC → 5V GND → GND SCK → SCK MOSI → MOSI MISO → MISO CS → D10
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9
#define SS_PIN 10
MFRC522 mfrc522(SS_PIN, RST_PIN);
void setup() {
SPI.begin();
mfrc522.PCD_Init();
}
void loop() {
if (mfrc522.PICC_IsNewCardPresent()) {
if (mfrc522.PICC_ReadCardSerial()) {
Serial.print("UID tag: ");
String content = "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++) {
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? "0" : "");
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? "0" : ""));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
Serial.println(content.substring(1));
delay(500);
}
}
}
Отзывов пока нет. Будьте первым!