This is confusing:
#ifdef NFC_DEMO_DEBUG
#endif
What's the point?
I'll get rid of all the #ifdef:
#include <PN532.h>
#include <SPI.h>
#include <SimpleSDAudio.h>
#define PN532_CS 10
PN532 nfc(PN532_CS);
void setup()
{
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (! versiondata)
{
while (1); // halt
}
nfc.SAMConfig();
} // end of setup
void loop(void)
{
uint32_t id;
id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A);
if (id != 0)
{
Serial.print("Read card #");
Serial.println(id);
if(id==4251492471)
{
if (SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO))
{
if(SdPlay.setFile("12.afm"))
{
SdPlay.play();
while(!SdPlay.isStopped())
{
SdPlay.worker();
}
}
}
}
}
}
You have this:
Serial.print("Read card #");
Serial.println(id);
But no Serial.begin.
OK, now we can read the code, what is the problem exactly?
I don't understand this:
it's work good
but for one time not work as a loop!!!!