Bringing in library also brings in example with duplicate loop function

So I have a project, find a useful library, then when I bring it in to the app I have also the example .cpp file. What is the correct proceedure to bring in the required parts but not the example - which gives me an unwanted loop and setup functions in the example file.

What did you do to import the library, “use this example” or “include in app”? The former includes the current tab you’re in, whereas the latter should import only the library.
It might help to know which library you’re trying to use.

I have my original app and found the ELAPSEDMILIS library. My plan requiring non blocking timers.
The only options I see are are ‘Include in Build’ or ‘Fork this library’.
I certinly didn’t want to work on another instance so I chose Include in Build.

I am new to all this Arduino / Github / Wiring … stuff coming from an AVR C background - where I have to create it all.

The object is to create non blocking timers with callbacks.

It seems to work for me.
Go to the library, then click:

Then pick the app to which you’d like to add it.

Then, confirm by pressing:

You should then have something like:

// This #include statement was automatically added by the Particle IDE.
#include "elapsedMillis/elapsedMillis.h"

at the top of your app.

Give that a try?

2 Likes

Hi,
Yes, it did include it… but - and this is where i may be misunderstanding, when I went to the ‘Included Librarys’ button, it displayed three files
ElaspsedMillis.cpp, ElapsedMillis.h and ElapsedMillisDemo.cpp

Assuming all these files are in my app, I have two loop() and two setup() functions in the whole code, one from MY app and one in the example,cpp.

But… Ahh, I guess all that’s actually in my app is the included .h file. and the button just gives me a link to view the original library.
Thanks for helping.