(Resolved) How can i add my own library?

Hello, i am new testing the photon and i have a problem with something.

I was looking for a library to use on my NFC shield, i found the Adafruit_PN532 in the Web plataform but it had not a some code that i use nowadays in my testing with the shield in SPI protocol.
The library tha i use was made by "// PN532 library by adafruit/ladyada // MIT license, and was edited by other autor and by me to implement a diferent modules of Read/write RFID/NFC.
I downloaded the Desktop IDE and tryed to include my library but it did not work.

Since 3 days i was looking for a tutorial or pages by Particle community where explain “How can Add a new library” and no one could explain me the steps to add my library or edit the Adafruit_PN532. By the Particle CLI or the Desktop IDE. The pages where i found the steps to add a new library it did not have to much information to solve my problem

i have my library in reference by the example “uber-library-example-master” changing the names and my code. if it is useful for someone.

Can someone help me?

How exactly did you include your library? Did you use the correct structure with Particle Dev?

About your first question,

  1. I was add like a new file and saved in the workspace.

  2. I tryed to use de CLI but i can not see results :confused:

Then i lookingfor information in the guides of particle.

i used this references in my first time: https://docs.particle.io/guide/tools-and-features/dev/

And then i found it guide https://docs.particle.io/guide/tools-and-features/libraries/

Now my structure is that

  • myapp
  • src

You would usually not copy the files manually

With (a recent version of) CLI you’d use the dedicated command

particle library add <libraryName>

with Desktop IDE you’d use the Library Manager

If you want the lib sources copied to your project you’d use the respective Copy to current project button.

This way you make sure the files are in the correct folders.
For your case you’d need a

  • myapp/lib/Lib_PN532/src/Lib_PN532.cpp and
  • myapp/lib/Lib_PN532/src/Lib_PN532.h

and main.ino would need to live in

  • myapp/src/

and it’s project.properties (I guess proyect.properties is a typo).

1 Like

When i compile the project all is ok :slight_smile: