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
- create any new “dummy” project
- run
- search and select your desired library
- go to the
./lib/<libraryName>/examples/<desiredExample>
folder - copy the contents of the
.ino
file of that example into your project.ino
- remove the entire examples folder from the library
- build
However, if @m_m could conjure up such a feature I’m sure many people would like that
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.
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.