Go Down

Topic: libraries (for dummies )- how to use them? (Read 992 times) previous topic - next topic


Hello guys, another newb  :smiley-roll-blue: question here.
I have managed to install the first library (Servo) and used it without problem.

But this was easy since I found it in a tutorial on arduino.cc, and I was able to see how it works.
My question goes, how to know what are functions of other libraries? Are there a list and descriptions of the functions? How do you guys how each library works?



I am under the impression that the Servo library is already installed in the IDE when you download the IDE?

I use it a lot and I have never had to install it.

Two or three hours spent thinking and reading documentation solves most programming problems.


Most of the official Arduino libraries do have documentation in the reference pages:

When it comes to 3rd party libraries, it's different from one library to another.

Usually you will find example sketches under File > Examples > {library name}. That's nice to have, but it's not really a substitute for a complete reference.

Sometimes they will be documented to some extent in the readme, which is displayed on the library repository home page. If you're installing the library via Library Manager (Sketch > Include library > Manage Libraries...), you can click the "More info" link and then continue your search from wherever that takes you.

Something that's easy to overlook is that GitHub repositories often have a "Wiki" tab at the top of the homepage. Sometimes that tab will contain documentation. More often, it will have nothing but the repository owner just never bothered to turn off the wiki option for their repository.

Sometimes the library author will not have bothered to write documentation, or the documentation will be incomplete or incorrect. The definitive (although not so beginner-friendly) reference will always be the source code. The .h files contain the function prototypes so that's useful to get a quick list of the available functions, and perhaps some explanatory comments. The function definitions will usually be in the .cpp (or more rarely .c) files, and this is where to look when you need to understand how the function actually works.

Go Up