Go Down

Topic: help with libraries.... (Read 225 times) previous topic - next topic

kpg

Feb 22, 2019, 04:31 pm Last Edit: Feb 22, 2019, 04:33 pm by kpg
I am trying to use a Elechouse PN532 module.

I am using this library

https://github.com/elechouse/PN532.

When unzipped I have a range of folders and I am not sure which one to put in my libraries folder.

I am using the SPI software mode so I tried putting the SPI folders .h and .cpp files under the main folder heading (PN532-PN532_HSU) but got this error when compiling.....

C:\Users\kgurr\Documents\Arduino\libraries\PN532-PN532_HSU/PN532_SPI.h:6:28: fatal error: PN532Interface.h: No such file or directory

 #include "PN532Interface.h"

My program call the .h file in;

#include <PN532_SPI.h>

I also tried just leaving those files in their subfolder but then the compiler cant find anything....

I ran the manage library install but it just came up with an older Adafruit library as installed that I have taken out of my library folder now. It doesn seem to be able to find the new library.!!!

Bit new to this so I am stuck.....

UKHeliBob

In general if you have a library named Wibble with Wibble.h and Wibble.cpp files together with any other supporting files then the files should go in a folder named Wibble in the libraries folder of your sketch directory

From your description it is not clear whether you used the Add .ZIP Library... option of Sketch/Include Library
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

kpg

#2
Feb 22, 2019, 05:31 pm Last Edit: Feb 22, 2019, 05:33 pm by kpg
I unzipped the library and the put all the folder and sub folder structure under my libraries folder,

Is this what you meant?

structure is ;
Libraries, PN532-PN532_HUS, then all the sub folders that get unzipped including the PN532-SPI one.

Should I redo and use the add zip option? I can see that In the library manager?

Thanks

kpg

Ah ha!

Found the option to add a zip library but then when it compiles I get ;

C:\Users\kgurr\Documents\Arduino\libraries\PN532-PN532_HSU/PN532_SPI.h:6:28: fatal error: PN532Interface.h: No such file or directory

 #include "PN532Interface.h"

                            ^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
Specified folder/zip file does not contain a valid library

kpg

I did initially try the adafruit library which compiled OK and while it found the module it wouldn't recognise cards......

UKHeliBob

Did you follow these instructions from the GitHub page ?

Quote
Getting Started

Download zip file and extract the 4 folders(PN532, PN532_SPI, PN532_I2C and PN532_HSU) into Arduino's libraries.
Downlaod Don's NDEF library and extract it intro Arduino's libraries.
Follow the examples of the two libraries.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

kpg

Think I am getting there thanks...

Those 4 subfolders are now just under my main libraries folder. So the compiler find them now.

Compared to the Adafruit library which has examples for software SPI these libraries only seem to have hardware SPI. So I'm stuck again now.

This all started because when I set it all up with the adafruit library and got this message when I tried to run the program....

Hello!
TIMEOUT!
Found chip PN532
Firmware ver. 1.6
Waiting for an ISO14443A card

I assumed it might be a driver issue (as it was an Adafruit one on an Elechouse module) so was trying another driver.

I guess the module could just be bust?

kpg

I have started again with the Adafruit library and have it all installed correctly

So now its just the software SPI I am struggling with. I want to run software SPI but I cant see how the ReadMifare programs sets the pins.

The only options are;

#include <SPI.h>
  #include <PN532_SPI.h>
  #include "PN532.h"

  PN532_SPI pn532spi(SPI, 10);
  PN532 nfc(pn532spi);

is this a hardware SPI configuration?

I am running a Mega

kpg

Thanks for the help Bob. Ive gone back to the Adafruit libraries and using the ICSP connector and it is good now.

Cheers

Go Up