Hello,
I’m an Arduino user, just getting started with Spark. I’d like to clarify the difference between how libraries are used in Arduino vs. Spark’s online IDE.
If I want to use a common library (servo.h, wire.h, spi.h), I shouldn’t use the #include. I can just instantiate the object, and the Spark online IDE knows what to compile in the library?
And I can see a list of libraries that Spark knows about by looking at the library window, right?
There are a couple of exceptions like Serial2, the third hardware serial port where you need to include a library. There are some things like the WiFi class that are just different since Spark doesn’t have ethernet, just WiFi.
Libraries in the web IDE are user-contributed libraries for things that are not built-in. One-wire, various chip-specific drivers, etc. can found there.
To use custom/user created libraries you have to both “Include” them in your app using the libraries browser in the WebIDE and make sure the proper “#include” statement is added to your project. The “#include” should be added automatically but sometimes it can get deleted by accident and even though the library is added to the project it won’t be found because it’s not "#include"d. Does that makes sense?
To keep from having to edit every file/library I use, I’ve found that the following code stuffed into a file called “Arduino.h” in my sketch folders helps. It would be a small step forward if the Particle dev env would provide something like this
in addition, the missing “binary constants” that the 'duino world defines for you (“B000”, “B10100000”, etc) can easily be ‘fixed’ by adding a ‘0’ in front of the ‘B’: 0B000, 0B10100000, etc.