About my programing

Hello friends, my project is to unlock using a piece of esp32 dvi v1
And pn532 and I have a problem
In programming, it is (no matching function for call to pn532 .).
This is an introduction to programming
The rest is correct

#include <Wire.h>

#include <PN532_SPI.h>//include to use the Witty Fox NFC board

#include <SPI.h>

#include <NDEF.h>

#include <NDEF_TXT.h>

#include "PN532.h"

#include <PN532_I2C.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);

Likely caused by an error in your program code.

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();

}

Read the forum guidelines to see how to properly post code and some good information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

You can go back and fix your original post by highlighting the code and clicking the </> in the menu bar.
code tags new

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Can you fixed please 

#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();

}
The message error is (no function call PN532)

I bet the error message is a little longer than that. At least I'd expect a line number to be in there somewhere. Please post the entire error message.

Why

Do

You

Have

So

Much

White

Space

In

Your

Program?
1 Like
the error massage
Arduino: 1.8.19 (Windows 10), Board: "DOIT ESP32 DEVKIT V1, 80MHz, 921600, None"





















sketch_apr02a:21:72: error: no matching function for call to 'PN532::PN532(int, int)'

  PN532 nfc(PN532i2c_BOOSTERPACK_RESET_PIN, PN532i2c_BOOSTERPACK_IRQ_PIN);

                                                                        ^

In file included from C:\Users\Huss-\Desktop\sketch_mar31a\sketch_mar31a\sketch_apr02a\sketch_apr02a.ino:11:0:

C:\Users\Huss-\Desktop\arduino-1.8.19-windows\libraries\PN532/PN532.h:130:5: note: candidate: PN532::PN532(PN532Interface&)

     PN532(PN532Interface &interface);

     ^

C:\Users\Huss-\Desktop\arduino-1.8.19-windows\libraries\PN532/PN532.h:130:5: note:   candidate expects 1 argument, 2 provided

C:\Users\Huss-\Desktop\arduino-1.8.19-windows\libraries\PN532/PN532.h:127:7: note: candidate: constexpr PN532::PN532(const PN532&)

 class PN532

       ^

C:\Users\Huss-\Desktop\arduino-1.8.19-windows\libraries\PN532/PN532.h:127:7: note:   candidate expects 1 argument, 2 provided

C:\Users\Huss-\Desktop\arduino-1.8.19-windows\libraries\PN532/PN532.h:127:7: note: candidate: constexpr PN532::PN532(PN532&&)

C:\Users\Huss-\Desktop\arduino-1.8.19-windows\libraries\PN532/PN532.h:127:7: note:   candidate expects 1 argument, 2 provided

C:\Users\Huss-\Desktop\sketch_mar31a\sketch_mar31a\sketch_apr02a\sketch_apr02a.ino: In function 'void setup()':

sketch_apr02a:63:7: error: 'class PN532' has no member named 'enable'

   nfc.enable();

       ^

C:\Users\Huss-\Desktop\sketch_mar31a\sketch_mar31a\sketch_apr02a\sketch_apr02a.ino: In function 'void loop()':

sketch_apr02a:85:11: error: 'class PN532' has no member named 'loop'

   if (nfc.loop())

           ^

sketch_apr02a:91:13: error: 'class PN532' has no member named 'isError'

     if (nfc.isError())

             ^

sketch_apr02a:101:13: error: 'class PN532' has no member named 'wasRead'

     if (nfc.wasRead())

             ^

sketch_apr02a:109:13: error: 'class PN532' has no member named 'available'

     if (nfc.available())

             ^

sketch_apr02a:115:26: error: 'class PN532' has no member named 'getDataLength'

       uint16_t len = nfc.getDataLength();

                          ^

sketch_apr02a:125:31: error: no matching function for call to 'NDEF_TXT::import(PN532&)'

       int ret = msg.import(nfc);

                               ^

In file included from C:\Users\Huss-\Desktop\sketch_mar31a\sketch_mar31a\sketch_apr02a\sketch_apr02a.ino:9:0:

C:\Users\Huss-\Documents\Arduino\libraries\RF430CL-master/NDEF_TXT.h:76:13: note: candidate: virtual int NDEF_TXT::import(Stream&)

         int import(Stream &s);  // For reading from a suitable NFC passive device, or any form of stream

             ^

C:\Users\Huss-\Documents\Arduino\libraries\RF430CL-master/NDEF_TXT.h:76:13: note:   no known conversion for argument 1 from 'PN532' to 'Stream&'

sketch_apr02a:185:11: error: 'class PN532' has no member named 'flush'

       nfc.flush();

           ^

sketch_apr02a:189:9: error: 'class PN532' has no member named 'enable'

     nfc.enable();

         ^

C:\Users\Huss-\Desktop\sketch_mar31a\sketch_mar31a\sketch_apr02a\sketch_apr02a.ino: In function 'void DumpSRAM()':

sketch_apr02a:205:7: error: 'class PN532' has no member named 'readSRAM'

   nfc.readSRAM(0x0000, sram, 128);

       ^

exit status 1

no matching function for call to 'PN532::PN532(int, int)'



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Did you read the error message?

The error messages are quite clear with what you need to fix.

Anyways, post a link to the library you are using. The Adafruit library is the one I keep finding, of course I am lazy and don't want to do your research for you.


And could you, please, use code tags?

see the different 
This program is correct 
#include <Wire.h>

#include <RF430CL.h> //include to use the Witty Fox NFC board

#include <NDEF.h>

#include <NDEF_TXT.h>

 

#define RF430CL330H_BOOSTERPACK_RESET_PIN 25 //reset pin of NFC board connected to GPIO

#define RF430CL330H_BOOSTERPACK_IRQ_PIN 26 //interrupt pin of NFC board connected to GPIO

 

RF430 nfc(RF430CL330H_BOOSTERPACK_RESET_PIN, RF430CL330H_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();

}

This is not correct 

#include <Wire.h>

#include <PN532_I2C> 

#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();

}
Both of them  is the same but i change rf430 to pn532

It looks like you don't bother to read any replies.

I read it but im confused 
Because im very bad for programming 
So i want helllp
Because tomorrow my presentation for my project
My project is NFC BASED SECURITY DOOR LOCK
Using pn532 and esp32 devi v1

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.