Category definition for Libraries


Use the Libraries category to discuss porting existing Arduino/Wiring libraries to the Particle device. Be sure to put the name of the library in the topic title. So that everyone can find the latest information on a particular library, try to keep one topic per library.


How can I include a library in the online builder?


Hello @Coffee,
You can make a pull request with your suggested library (when approved and merged, it will become a part of the online cloud compiler). Other approach is to simply include all the functions from the library into your application file directly.


mohit, I tried that but ran into problems I describe here:

Could you please look into it and give me a hint?


So that would typically be a pull request to the core-common-lib Git repos? This is the official place for ported libraries?


What would be awesome is a package manager style feature in the cloud editor. Where you can search for user submitted libraries and hit the checkbox beside them to include them in your build. The package manager could check on rebuild to see if a newer version exists from the specified github repo.

This approach would be easier than copying and pasting hundred of lines into a single file, and much more up to date than having to submit pull-requests that are manually added to the cloud compiler after they are reviewed by the guys at Spark.

Just a suggestion :wink:


…especially if the package structure is such that it is easy to maintain in Git as well for those who prefer building the software on their own machines.


OK - sorry - I really don’t get this.

There is an library for the AdaFruit SSD1306 that I saw here and I would like to try it.

Are you saying that these libraries are here already or I need to request them somehow?


@zachary on which repo should i send a pull request? is there an example?


We’re working on standardizing this, but we’re not there yet. The best path would be to create a public github repo with at least the .h and .cpp files that comprise your library. Also, the repo should probably have an example .ino file showing out to use it, plus a good README. Once you get that far, post a new thread in the Libraries category so people can give feedback.



One shortcoming with the Arduino ecosystem is that it has not learned from other environments and done libraries right. In order to do libraries right, there needs to be a defined structure in place for how you write, version, publish, install, uninstall, browse by category, search etc.

We need two things

  1. A standardized way to structure library projects. A common source structure, a common way to build and test them, a common way to document them, package them and add metadata to them. Look at CPAN, Maven, Ruby Gems etc.

  2. A de-centralized way to publish libraries. Having only a common repository for lots of libraries doesn’t really work. I would recommend studying how Homebrew on OSX works. They’ve gotten a lot of things right. An important point for why it needs to be done in a de-centralized manner is that it should be possible to publish libraries properly without having them included in any official repos that the user does not control.

I think we should start work on these two things. If we accomplish point 1, there are several ways we can accomplish 2.

I think we can design 1 without tying ourselves to how we solve 2.

Library metadata will be important and no library should be accepted into any official repos or listing without a metadata file that at the very least categorizes the library, adds tags, a 50 character description, a one-paragraph description, constraints (hardware, version etc) and dependencies. (Metadata model needs to be versioned and schema should be designed for evolution)


Hi @borud,

Great points! We’ve started setting up a structured system for writing and distributing libraries, we plan on adding better library integration to the CLI as well, but in the meantime (not sure if you’ve seen this yet), there is a great structured example here:

and here:

2.) I think we intend to allow importing of a library from any git repo, so that’s a pretty decentralized system. :slight_smile:

I think I’ll ping @jgoggins in case I missed anything.



Hey @borud ,

Great points indeed, I hope our library system has taken a good first step toward this, at least for point #1. Regarding point #2, “a decentralized way to publish libraries”. When we put some time into making libraries work with with the spark-cli + local build environment, I would imagine that we’ll be able to support this. At the very least, it’d be nice to be able to bind a library dependency to a git repo url rather than the central published lib name + version.