This is the code, i'm trying to read the NFC UID number, and store it to SD Card.
and this is the link to the hardware
http://shieldlist.org/itead-studio/sdcard
#include <SPI.h>
#include <PN532_SPI.h>
#include <PN532.h>
#include <NfcAdapter.h>
#include <SD.h>
const int chipselect=7;
PN532_SPI pn532spi(SPI, 10);
NfcAdapter nfc = NfcAdapter(pn532spi);
int hold=0;
void setup(void) {
Serial.begin(9600);
Serial.println("NDEF Reader");
nfc.begin();
}
void loop(void) {
nfc.begin();
if (nfc.tagPresent()==1)
{
NfcTag tag = nfc.read();
// Serial.println(tag.getTagType());
Serial.print("UID: ");Serial.println(tag.getUidString());
SD.begin(chipselect);
File dataFile = SD.open("datalog.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.println(tag.getUidString());
dataFile.close();
Serial.println("SAVE SUCCES");delay(100);
}
else {
Serial.println("error opening datalog.txt");
}
}
else if(nfc.tagPresent()==0) { Serial.println("Scan a NFC tag\n");}
delay(1000);
}