RFID,NFC Module(PN532): 두 판 사이의 차이
잔글 (→Libraries) |
잔글편집 요약 없음 |
||
| 49번째 줄: | 49번째 줄: | ||
=== [[Arduino Libraries|Installation Method]] === | === [[Arduino Libraries|Installation Method]] === | ||
== '''Example Code''' == | == '''Example Code''' == | ||
2025년 3월 21일 (금) 16:48 기준 최신판

This is an NFC module that allows communication mode selection among UART, I2C, and SPI through two built-in switches.
In this document, we proceed with the I2C method. For those interested in other methods, please refer to the PN532 guide.
Specifications
- Operating Voltage: 5V
- Interface: UART, I2C, SPI
- Operating Distance: up to 5cm ~ 7cm
Hardware
- Arduino
- PN532
- Jumper cables
Connection
| Arudino UNO | PN532 |
| 5V | VCC |
| GND | GND |
| A4 | SDA |
| A5 | SCL |

Libraries
- Wire
- PN532_I2C
- PN532
- NfcAdapter
Library Download
Installation Method
Example Code
// for I2C Communication (SDA(A4), SCL(A5))
#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>
PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
String tagId = "None";
byte nuidPICC[4];
void setup(void) {
Serial.begin(9600);
Serial.println("Serial start");
nfc.begin();
}
void loop() {
readNFC();
}
void readNFC() {
if (nfc.tagPresent()) {
Serial.println("============================================");
NfcTag tag = nfc.read();
tag.print();
tagId = tag.getUidString();
}
delay(1000);
}
Execution Result
