Can you fixed please
This is my programming
#include <Wire.h>
#include <PN532_SPI>
#include <NDEF.h>
#include <NDEF_TXT.h>
#define PN532i2c_BOOSTERPACK_RESET_PIN 25 //reset pin of NFC board connected to GPIO
#define PN532i2c_BOOSTERPACK_IRQ_PIN 26 //interrupt pin of NFC board connected to GPIO
PN532 nfc(PN532i2c_BOOSTERPACK_RESET_PIN, PN532i2c_BOOSTERPACK_IRQ_PIN);
NDEF_TXT msg;
uint8_t buf[512];
String password = "Robocraze"; //declaration of the password which will unlock the door
void DumpSRAM();
void setup()
{
Serial.begin(115200);
delay(1000);
pinMode(2, OUTPUT); //pin connected to on-board LED
pinMode(13, OUTPUT); //pin connected to input of Relay
Serial.println("Initializing I2C-");
Wire.begin();
Serial.println("Initializing NFC Tag-");
nfc.begin();
Serial.println("Activating NFC transceiver-");
nfc.enable();
Serial.println("Now waiting for NFC master to post a Text block.");
msg.setPayloadBuffer(buf, 512); // Set allocation buffer used to store incoming NDEF data
}
void loop()
{
digitalWrite(13, HIGH);
if (nfc.loop())
{
// If nfc.loop() returns true, nfc.disable() is implicitly run...
if (nfc.isError())
{
Serial.println("NFC transceiver reports its SRAM contents do not contain valid NDEF data.");
DumpSRAM();
}
if (nfc.wasRead())
{
Serial.println("NDEF tag was read!");
}
if (nfc.available())
{
Serial.print("NFC master has written a new tag! ");
uint16_t len = nfc.getDataLength();
Serial.print(len);
Serial.println(" bytes");
Serial.println("Assuming data is NDEF TEXT; importing-");
int ret = msg.import(nfc);
if (ret < 0)
{
Serial.println("ERROR importing NDEF TEXT data. SRAM dump:");
DumpSRAM();
}
else
{
Serial.println("Success!");
Serial.print("Language code: ");
Serial.println(msg.getLanguage());
Serial.println("Text block:");
String Data = msg.getText();
Serial.println(Data);
if (Data == password) //door will only unlock if the received message matches with the password set in the beginning
{
int i;
for (i = 0; i < 5; i++)
{
digitalWrite(13, LOW); //door will unlock for approximately 5 seconds
//blink onboard LED when the door is unlocked
digitalWrite(2, HIGH);
delay(500);
digitalWrite(2, LOW);
delay(500);
}
i = 0;
}
}
nfc.flush();
}
nfc.enable();
}
}
void DumpSRAM()
{
uint8_t sram[128];
nfc.readSRAM(0x0000, sram, 128);
for (int i = 0; i < 128; i++)
{
if (sram[i] < 0x10)
Serial.print('0');
Serial.print(sram[i], HEX);
Serial.print(' ');
if (i % 9 == 8)
Serial.println();
}
Serial.println();
}