Notifications
Clear all

Question About Libraries

3 Posts
3 Users
0 Likes
2,060 Views
Berner
(@berner)
Member
Joined: 5 years ago
Posts: 31
Topic starter  

I am new to programming, but otherwise very tech savvy. In the world of Arduino IDE programming, I am trying to understand a few things about include libraries. How does one go about learning what functionality a library offers? I notice that after installing a library, there is often new example sketches to look at, but I was wondering if there was a better place to find such info?


   
Quote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

Arduino Reference Page

Notice the links to:

  1. Language
  2. Functions
  3. Variables
  4. Structure
  5. Libraries
  6. Glossary

For example here's the Arduino reference page for the SD card library:

Arduino SD Library

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@berner

Most of the libraries available for the Arduino are Open Source i.e. written by amateurs. Some are well documented, an example is the "Arduino SD Library" mentioned by @robo-pi immediately above. Others are poorly documented leaving the user to try and identify methods employed from the accompanying example sketches.

Here is a tip for finding out what methods/functions and defined constants are available from each library without sifting through the .cpp file!

Go to your sketch folder, open up the libraries folder, open your chosen library folder and, if the programmer hasn't been too lazy, you will find a file called "keywords.txt". This lists all the above-mentioned info and will give you a starting point to use any particular library function.

Alternatively, look in the .cpp file for "::", this generally is a separator between the class name and a function.

Example:

void FirmataClass::begin(void)

FirmataClass = Class Name

begin(void) = Function

I hope this brings a little more clarity about the subject of Arduino/C++ libraries.


   
ReplyQuote