don/NDEF

Sleep mode

Closed this issue · 0 comments

Hi, for my task it is necessary to turn off the power to the pn532 module for a couple of seconds or so. I saw on the forum that it is possible to implement a sleep mode, but unfortunately I can't integrate it. According to the idea there should be something like this:

#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>

PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);

void setup(void) {Serial.begin(115200);}

void loop() {
    Serial.println("\nPlace a formatted Mifare Classic NFC tag on the reader.");
    while (Serial.available() == 0) {}
    String ra = Serial.readString();
    ra.trim();
    Serial.println(ra);
    if (ra!="01"){
          nfc.begin();
    if (nfc.tagPresent()) {
        NdefMessage message = NdefMessage();
        message.addTextRecord(ra);
        bool success = nfc.write(message);
        if (success) {
          Serial.println("Success. Try reading this tag with your phone.");
          nfc.POWERDOWN();
        } else {
          Serial.println("Write failed.");}}}}

But I can't integrate the method described on the forum into "NfcAdapter.cpp " and "NfcAdapter.h"... Please help me.