How to test a library

I’m trying to figure out how to test one of the examples shipped with a library, however I’m running into issue with not being able to find header files, and things not compiling as a result. What’s the easiest way to grab a particle official library, compile one of the examples, and run it on a particle board using the Workbench?

AFAICT there is no dedicated way to build a library example directly like in Web IDE where you have a USE THIS EXAMPLE button.

But you can

  1. create any new “dummy” project
  2. run
    image
  3. search and select your desired library
  4. go to the ./lib/<libraryName>/examples/<desiredExample> folder
  5. copy the contents of the .ino file of that example into your project .ino
  6. remove the entire examples folder from the library
  7. build

However, if @m_m could conjure up such a feature I’m sure many people would :+1: like that :sunglasses:

1 Like

Okay thanks, it’s just a pain even for developing a library. Constantly copying files back and forth, and then removing project files to publish the library, etc.

1 Like

If you are in the process of creating/porting a library there is no need for all that back an forth.
You setup the project including your local library once and finish the development and testing as if you’d do with any other project.
Once that’s done you’d cd into your .lib/<yourLib>/ folder and call particle library upload from there.
Any examples you want to provide should be stored in a temporary folder that’s not used for building and only be copied - once when done - into the library folder before upload.

When you understand how the project folder hierarchy works things get quite simple.

1 Like