Main Menu

search

You are here

Libraries

[last updated: 2022-03-09]
Arduino home page
Installing Contributed Libraries
nRF24 Libraries
-----

  • Libraries are a set of files, written in C or C++. The files will be in a folder, and the name of the folder is the "Library name".
    In a given library folder, there must be (perhaps some exceptions to this...) at least a [libName].cpp and a [libName].h file.
    There also may be a file named keywords.txt, a file named library.properties, a folder named examples, and perhaps other files.
    There may be other .cpp and .h files as well. These would define other libraries that are needed by the main libName.

  • Some core libraries are included with your Arduino installation. These library files are typically located in:
    .../arduino-1.8.13/libraries

  • "User-contributed" libraries are most often a set of functions needed to conveniently interface with some piece of hardware, like a sensor or a display.
    On both Windows and Linux PC's, user-installed/contributed libraries are located in:
    [sketchbook]/libraries folder
      (go to IDE: File > Preferences ... to find or change location of your sketchbook folder on your system)

  • ? ? ? ? On my Linux Dell-4600, there are other libraries located in:
    /home/jay/.arduino15/packages ...
    Don't know how these got here, but in fact going to IDE > Sketch > Include Library ... brings up a list with some of them.

  • "'include" libraries:
    In Arduinos, you allow a library and its functions to be used in your sketch by "including" them.
    The include statements are typically placed near the top of your sketch.
    Libraries can be included into your sketches with two different syntax':
    They can either be quoted or angle-bracketed.
      ie. quoted: #includes " [libName] "
      vs. angle-braketed: #includes < [libName] >

      These two alternatives specify where the program/compiler looks to find a library it needs.
      The quotes specify "local", meaning (I think) the folder where the program itself is located,
      while the brackets specify the "standard location", which (I think) is either the folder with core/embedded libraries that come with the IDE install,
      or the [sketchbook]/libraries folder for contributed libraries.

      Not sure about this... if there is a src folder, IDE will look there and ignore what might be in library folder, even if there are no files in src folder (?)

  • Editing libraries:
    • This is a dangerous thing to do, and should not be attempted if you don't know what you're doing.
    • That said, regardless of not knowing what I'm doing, I had a need to edit the Adafruit_GPS library ((go to:) see GPS page).
      I edited both the .h and the .cpp files per forum instructions.
      To be safe, I saved the original, un-edited versions, and put them into a sub-folder of the src folder (where they were originally located).
      However, when I executed the program, it gave an error, because instead of finding the edited library still located in the src folder,
      it found the un-edited version in the src/archiveOrig folder I'd created. How did it know? No clue.
      But I fixed it by moving the archive version into the library folder (src folder parent). Then it worked and found the edited version I intended.

    ----------------------------------------------------------------

.

.

.

eof