35 lines
594 B
C++
35 lines
594 B
C++
|
|
#if 0
|
|
#include <SPI.h>
|
|
#include <PN532_SPI.h>
|
|
#include <PN532.h>
|
|
#include <NfcAdapter.h>
|
|
|
|
PN532_SPI pn532spi(SPI, 10);
|
|
NfcAdapter nfc = NfcAdapter(pn532spi);
|
|
#else
|
|
|
|
#include <Wire.h>
|
|
#include <PN532_I2C.h>
|
|
#include <PN532.h>
|
|
#include <NfcAdapter.h>
|
|
|
|
PN532_I2C pn532_i2c(Wire);
|
|
NfcAdapter nfc = NfcAdapter(pn532_i2c);
|
|
#endif
|
|
|
|
void setup(void) {
|
|
Serial.begin(9600);
|
|
Serial.println("NDEF Reader");
|
|
nfc.begin();
|
|
}
|
|
|
|
void loop(void) {
|
|
Serial.println("\nScan a NFC tag\n");
|
|
if (nfc.tagPresent())
|
|
{
|
|
NfcTag tag = nfc.read();
|
|
tag.print();
|
|
}
|
|
delay(5000);
|
|
} |