Maker Faire - September 21, 2014
One or more NDEF Records
Contains a payload of data
Information describing the payload
Adafruit NFC Shield
http://www.adafruit.com/products/789Seeed Studio NFC Shield
http://www.seeedstudio.com/depot/nfc-shield-v20-p-1370.html
if (nfc.tagPresent()) {
NfcTag tag = nfc.read();
NdefMessage message = tag.getNdefMessage();
NdefRecord record = message[0];
if (record.getTnf() == TNF_MIME_MEDIA &&
record.getType() == "text/led") {
String payload = getPayloadAsString(record);
color = parseColor(payload);
// turn on the lights
}
}
Simple NDEF Exchange Protocol (SNEP)
#include "SPI.h"
#include "PN532_SPI.h"
#include "snep.h"
#include "NdefMessage.h"
PN532_SPI pn532spi(SPI, 10);
SNEP nfc(pn532spi);
uint8_t ndefBuf[128];
NdefMessage message = NdefMessage();
message.addUriRecord("http://arduino.cc");
int messageSize = message.getEncodedSize();
message.encode(ndefBuf);
nfc.write(ndefBuf, messageSize));
int size = nfc.read(ndefBuf, sizeof(ndefBuf));
if (size > 0) {
NdefMessage msg = NdefMessage(ndefBuf, size);
msg.print();
} else {
Serial.println("Error reading message");
}
Read Tags PhoneGap NFC Reader
Format and Unformat Mifare Classic Tags NXP Tag Writer
View Raw Data on Tag NFC TagInfo by NXP
View Raw Data on Tag NFC Tag Info
Don Coleman
Arduino NFC by Don Coleman
is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at https://github.com/don/.../2014-09-21-makerfaire-nfc.