help with libraries....

I am trying to use a Elechouse PN532 module.

I am using this library

GitHub - elechouse/PN532: NFC library for Arduino using 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.....

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

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

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

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

Did you follow these instructions from the GitHub page ?

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.

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?

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

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

Cheers