# Spark Libraries Available in IDE

**URL:** <https://community.particle.io/t/spark-libraries-available-in-ide/4652>\
**Category:** Libraries\
**Created:** [May 27, 2014, 10:12pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652 "2014-05-27T22:12:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgoggins](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jgoggins/32/20654_2.png) [@jgoggins](https://community.particle.io/u/jgoggins)\
**Post date:** [May 27, 2014, 10:12pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/1 "2014-05-27T22:12:45Z")

</div>

We just shipped Spark Libraries to the Build IDE. This feature let’s you pull in firmware code from GitHub and reuse it in your applications. Thanks so much to the incredible folks in the Spark community for providing the input to build this feature–we could not have done it without you! Here are a few links to get you started:

- [Blog Post](http://blog.spark.io/2014/05/27/flashing-firmware-with-spark-libraries/): Get started. Include a library in an app.
- [Docs Page](http://docs.spark.io/start/#flash-apps-with-spark-build-using-libraries): Learn more. What else does it do?
- [Annotated Example Library](https://github.com/spark/uber-library-example): Build your own.
- Community Contributed Examples:
  - [Neopixel](https://github.com/technobly/SparkCore-NeoPixel): An implementation of Adafruit’s NeoPixel RGB LED Library for the Spark Core by [BDub](https://community.spark.io/users/bdub/activity)
  - [Thermistor](https://github.com/wgbartley/spark-thermistor-library): A simple class for calculating temperature from simple 10K negative temperature coefficient (NTC) thermistors by [wgbartley](https://community.spark.io/users/wgbartley/activity)

Also, a few rough edges we’re currently aware of as well:

#### Limitations

- Libraries cannot depend on other libraries.
- You can’t yet fork examples from the library, you need to copy and paste into the app that includes the library.

#### Bugs

- Non UTF8 source files break things; there should be a validation.
- Upgrading a library in an app requires you to first remove it from the app, then re-add it.
- ~~There are some edge cases where “number of including apps” metric is not correct.~~

If you happen to run into snags or bugs with this feature, please report it here and we’ll try our best to get you unstuck. Additionally, two very simple workarounds that often fix the subtle IDE bugs include 1) refreshing the page, or 2) creating a new app and copy and pasting things into it.

Please let us know if you have questions or comments too.  
We’re excited to see what you do with this feature!

---

<div class="post-metadata">

**Author:** ![jgoggins](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jgoggins/32/20654_2.png) [@jgoggins](https://community.particle.io/u/jgoggins)\
**Post date:** [May 27, 2014, 10:14pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/2 "2014-05-27T22:14:03Z")

</div>

ping @BDub, @timb, @Hypnopompia, @david_s5, @peekay123, @wgbartley, @bko, @kennethlimcp

---

<div class="post-metadata">

**Author:** ![zach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/zach/32/20714_2.png) [@zach](https://community.particle.io/u/zach)\
**Post date:** [May 28, 2014, 4:07am UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/8 "2014-05-28T04:07:46Z")

</div>



---

<div class="post-metadata">

**Author:** ![Bruster](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Bruster](https://community.particle.io/u/Bruster)\
**Post date:** [May 30, 2014, 2:45pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/9 "2014-05-30T14:45:37Z")

</div>

Hi, I am completely new to the Spark community and a novice Arduino enthusiast. I just received my Spark Core yesterday and have been struggling with trying to compile an existing Arduino sketch. In particular, can someone post how I can include Spark Libraries.

For my sketch I need the following libraries: Time.h, String.h, LiquidCrystal.h and stdlib.h in my code?

When I compile I keep getting the error “…bruster999/ArduinoLibraries/Time/Time.h: No such file or directory”.

Existing code: #include \<Time.h\>

---

<div class="post-metadata">

**Author:** ![jgoggins](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jgoggins/32/20654_2.png) [@jgoggins](https://community.particle.io/u/jgoggins)\
**Post date:** [May 30, 2014, 5:32pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/10 "2014-05-30T17:32:19Z")

</div>

Hey @Bruster , many of the libraries you’re accustom to using with Arduino are available without needing to make explicit `#include` statements. Check out [http://docs.spark.io/firmware/](http://docs.spark.io/firmware/) for lots of documentation and examples! I’m fairly certain that all of the functionality in Time.h, String.h, and stdlib.h are available without an `#include` statement.

The Liquid Crystal library will require some additional custom code, check out [this thread](https://community.spark.io/t/liquid-crystal-library/1048) for more information. This library has not been imported and published into the Build IDE, so it still requires a bit of copy and pasting to get it to work.

---

<div class="post-metadata">

**Author:** ![Bruster](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Bruster](https://community.particle.io/u/Bruster)\
**Post date:** [May 30, 2014, 9:38pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/11 "2014-05-30T21:38:19Z")

</div>

> [@jgoggins](#):
>
> This library has not been imported and published into the Build

Thanks for that. I'm new to GitHub (ugh) as well as Spark and I'm having trouble getting the Build app to recognize my library when I upload it. Can you point me to a how-to on adding custom libraries via GitHub?

Also, how can I tell what libraries are available (Time, stdlib, etc.)?

Thanks, Bruce

---

<div class="post-metadata">

**Author:** ![wgbartley](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/wgbartley/32/1910_2.png) [@wgbartley](https://community.particle.io/u/wgbartley)\
**Post date:** [May 30, 2014, 9:49pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/12 "2014-05-30T21:49:11Z")

</div>

@Bruster - You can check out the [uber-library-example](https://github.com/spark/uber-library-example) as a framework/template for a new library.

I’ve managed to port 5 libraries today, and I’m still a relative noob to C/C++, so it’s not terrible to create a library. I have definitely gotten much better/faster at it.

I don’t know where to find what stuff is already available in the core firmware. If you get errors with variable types not being found (like uint16\_t, uint32\_t, etc), add `#include "application.h"` at the top of your `.h` file. Some math functionality like `pow()` and `log()` are not included by default, so you’ll want to add `#include <math.h>` at the top of your `.h` file as well.

---

<div class="post-metadata">

**Author:** ![Bruster](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Bruster](https://community.particle.io/u/Bruster)\
**Post date:** [May 30, 2014, 9:49pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/13 "2014-05-30T21:49:19Z")

</div>

…additional info. I have uploaded the files to the following location on GitHub:/bruster999/ArduinoLibraries/LiquidCrystal\_I2C. I have uploaded this to the Build app as well, however, when I click the ArduinoLibraries icon then the “Verify” button I see a blank screen to the right so that in itself is suspect.

Here is my include:  
’#include “ArduinoLibraries/LiquidCrystal\_I2C/LiquidCrystal\_I2C.h”’

Is this the correct format/syntax for the include?

---

<div class="post-metadata">

**Author:** ![Bruster](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Bruster](https://community.particle.io/u/Bruster)\
**Post date:** [May 30, 2014, 9:51pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/14 "2014-05-30T21:51:43Z")

</div>

Thanks! good advice.  
I think my issue is getting the library from GitHub to Build.

---

<div class="post-metadata">

**Author:** ![wgbartley](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/wgbartley/32/1910_2.png) [@wgbartley](https://community.particle.io/u/wgbartley)\
**Post date:** [May 30, 2014, 9:53pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/15 "2014-05-30T21:53:53Z")

</div>

You’ll need to make a new repository for each library you wish to import into the web IDE. So you can take your code from `ArduinoLibraries/LiquidCrystal_I2C/*` and create a new `LiquidCrystal_I2C` repository from that code.

---

<div class="post-metadata">

**Author:** ![ijw](https://avatars.discourse-cdn.com/v4/letter/i/d07c76/32.png) [@ijw](https://community.particle.io/u/ijw)\
**Post date:** [June 1, 2014, 4:45am UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/16 "2014-06-01T04:45:52Z")

</div>

Just playing with creating a library from a general purpose function I wrote into one my my first applications. Seems like the only way I can use a library is to publish it and make it available to the world, which is a bit annoying cos I’d quite like to test it works first…

---

<div class="post-metadata">

**Author:** ![ijw](https://avatars.discourse-cdn.com/v4/letter/i/d07c76/32.png) [@ijw](https://community.particle.io/u/ijw)\
**Post date:** [June 1, 2014, 5:02am UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/17 "2014-06-01T05:02:10Z")

</div>

Also, does it automatically pick up changes in the github repository? If it does, it’s taking a while to think about it.

---

<div class="post-metadata">

**Author:** ![wgbartley](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/wgbartley/32/1910_2.png) [@wgbartley](https://community.particle.io/u/wgbartley)\
**Post date:** [June 1, 2014, 5:50am UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/18 "2014-06-01T05:50:55Z")

</div>

Private libraries would be nice. It might be something easy to add just by toggling a flag in the web IDE, but I don’t want to assume too much!

It does not automatically update changes from GitHub. You will simply need to increment the version number in the `spark.json` file and contribute it again. It’ll still list older versions in your view of the web IDE, but I think it only shows the latest version to other users. I know they plan on allowing users to do a little more clean-up, but they wanted to push the library functionality out to users ASAP. You can bet it’ll get better every sprint cycle.

---

<div class="post-metadata">

**Author:** ![Bruster](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Bruster](https://community.particle.io/u/Bruster)\
**Post date:** [June 1, 2014, 8:00pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/19 "2014-06-01T20:00:42Z")

</div>

> [@ijw](#):
>
> publish it and make it available to the world

I'm feeling kinda foolish here as I still cannot get the library into Spark. I took wgbartley's advice and created a new LiquidCrystal\_I2C repository in GitHub (repo is bruster999/LiquidCrystal\_I2C where bruster999 is my account name). In Spark I clicked on the "Contribute Library" button then entered "bruster999/LiquidCrystal\_I2C" in the entry field and clicked on the Add Repository button. No errors appeared. The next screen shows text in the left panel - "Current Library" and below it is my library name - "LiquidCrystal\_I2C". There are two buttons, "Validate" and "Remove Library" on the left and a blank white screen on the right panel. Clicking on "Validate" does nothing. Clicking on Remove Library removes the library. I never see the "Include in App" button, there are no files listed and I see no way of publishing it.

Why is Spark not importing my library? What Am I doing wrong?

---

<div class="post-metadata">

**Author:** ![wgbartley](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/wgbartley/32/1910_2.png) [@wgbartley](https://community.particle.io/u/wgbartley)\
**Post date:** [June 1, 2014, 10:53pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/20 "2014-06-01T22:53:46Z")

</div>

> [@Bruster](#):
>
> Why is Spark not importing my library? What Am I doing wrong?

You'll need to structure the files similar to the [uber-library-example](https://github.com/spark/uber-library-example#the-spark-library-spec). If you're still having trouble, I can try to help set it up for you after I get all the kids to bed tonight.

---

<div class="post-metadata">

**Author:** ![Bruster](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Bruster](https://community.particle.io/u/Bruster)\
**Post date:** [June 2, 2014, 3:17am UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/21 "2014-06-02T03:17:05Z")

</div>

Thanks but I finally got it. I was missing the spark.json file. An error message would have been really helpful. 😉  
Thanks to all who responded.  
B

---

<div class="post-metadata">

**Author:** ![wgbartley](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/wgbartley/32/1910_2.png) [@wgbartley](https://community.particle.io/u/wgbartley)\
**Post date:** [June 2, 2014, 3:28am UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/22 "2014-06-02T03:28:41Z")

</div>

> [@Bruster](#):
>
> An error message would have been really helpful.

They're aware of that issue and it should be fixed in the next week or two.

---

<div class="post-metadata">

**Author:** ![jgoggins](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jgoggins/32/20654_2.png) [@jgoggins](https://community.particle.io/u/jgoggins)\
**Post date:** [June 2, 2014, 3:37pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/23 "2014-06-02T15:37:32Z")

</div>

> [@ijw](#):
>
> the only way I can use a library is to publish it and make it available to the world, which is a bit annoying cos I'd quite like to test it works first...

> [@wgbartley](#):
>
> Private libraries would be nice

Thanks for bringing this issue up and suggested solution, good idea. There definitely needs to be a way to iterate more quickly to ensure the library behaves as expected before publishing to everyone.

---

<div class="post-metadata">

**Author:** ![psb777](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/psb777/32/934_2.png) [@psb777](https://community.particle.io/u/psb777)\
**Post date:** [June 7, 2014, 8:25am UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/24 "2014-06-07T08:25:48Z")

</div>

> [@jgoggins](#):
>
> Libraries cannot depend on other libraries.

Is this a temporary limitation, or one unlikely to go away?

---

<div class="post-metadata">

**Author:** ![wgbartley](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/wgbartley/32/1910_2.png) [@wgbartley](https://community.particle.io/u/wgbartley)\
**Post date:** [June 7, 2014, 11:20pm UTC](https://community.particle.io/t/spark-libraries-available-in-ide/4652/25 "2014-06-07T23:20:16Z")

</div>

> [@psb777](#):
>
> Is this a temporary limitation

It is temporary. The game plan was to get library support out in the wild and hammer out the kinks that didn't crop up in development. Once it's settled, library dependencies and possible git submodule support would begin work.

@jgoggins, Feel free to tell me to shut up if I "oversold" something. 😉

[Next page](https://community.particle.io/t/spark-libraries-available-in-ide/4652.md?page=2)
