Where Are Arduino Libraries Stored? Here’s What You Should Know
When it comes to using Arduino libraries, there are a lot of things to learn and digest. One of the biggest things I’ve wondered about these libraries is where are they stored.
Consequently, in this guide, I’ll be dissecting what an Arduino library is, where you can find it, why it’s important, and as an added bonus, I’ll show you 2 different places where you can find the examples stored in a library.
But first, let’s first define:
What Is An Arduino Library?
As I mentioned previously, a library for Arduino is a file that contains different functions that serve different purposes such as working with sensors or LCDs (liquid crystal displays).
However, these files didn’t come out of nowhere; bright individuals documented and packaged what they’ve learned into files. Now, any Arduino user can access them and use each other’s knowledge and experience.
These files are written in the programming languages C (which has files ending in .c) and C++ (which has files ending in .cpp).
There are also three different types of libraries: standard, contributed, and recommended.
Standard libraries are the ones pre-installed on your IDE. This is the first group of libraries when you go to your Sketch menu in your IDE and click on “Include Library”.
Contributed libraries are the libraries that you have found and installed on your own accords. They are the second group of libraries.
The final group of libraries is called the recommended library. This is a type of contributed library, but they’re installed by the Arduino company itself. They’ve deemed these libraries to be trustworthy and reliable for users to use.
Where Is An Arduino Library Stored?
The Arduino library is stored in the sketchbook folder. This sketchbook folder contains all the contributed libraries that you’ve installed since that’s where the Arduino IDE stores it. In addition, this is the place where the Arduino IDE will go through to find your previous sketches.
Here are the simple steps you’l need to follow to access your libraries manually:
- Open up your Arduino IDE
- Go to the File menu
- Move your cursor down and click on the word “Preference”
- Alternatively, you could’ve just used the keyboard shortcut: ctrl + comma (,)
- Once the Preference menu has popped up, look under “Sketchbook Location”
- This basically gives you the address to where the Arduino IDE has stored your library in your files.
- Then, you’ll need to follow the address when you’re going through your files, and you should come across your libraries
I’ve included some pictures to help guide you through this journey:
As you can see, my libraries are located under my home, my name, and the folder named Arduino.
Note: I don’t have any contributed libraries installed at the time of writing, which is why I didn’t show what’s inside my folder. If I did, it would be empty.
Where Are The Library Examples Stored In Arduino?
When you’re getting into working with libraries in the Arduino IDE, the best resources you have to understanding what the library does and how you can utilize a library to its fullest potential is by looking at the documentation and the examples.
The examples can greatly improve your understanding because it actually uses the functions in the library in real-life scenarios.
You can easily find the examples by using one of two ways:
The first way is to install the library and take a peek at the examples in the Arduino IDE. This method is easier to use compared to the second way if you already have it installed.
- Go to the File menu at the top
- Click “Examples”
- Find your library and click on it
- Now, you should see examples that you can click on
- Doing so will open a new tab
- You can experiment with the code and run it
See the following example for guidance:
The second method is by directly going to Github. You should find the folder called “example”. Click on it, and you can choose the examples. If you want to run it, you have to copy and paste the code into your IDE. See the following image for more explanation:
Why Are Libraries Important?
Arduino libraries are extremely important because they make it easier for users to share and utilize other Arduino users’ work. Consequently, this creates a collaborative environment that encourages innovation. Moreover, users can save time on certain aspects of their project because some functionalities have been coded before. All they need to do is to install and use the library.
Let’s use an example to break this down. Say your air conditioner is broken. Of course, you can fix it yourself, but you don’t know where to begin or you don’t want to do all the research to fix one thing. The best and easiest solution for you is to go onto YouTube and look for videos that teach you how to do that.
The Arduino library basically saves you the trouble like YouTube videos: it’s created by users for users and it’s completely free!
If you want to learn more about libraries, check out my other blog on choosing the right library and another one for dealing with library problems.
Summary – tl;dr (Too Long; Didn’t Read)
Here are the main points you should remember after reading this article:
- Arduino libraries are files that contain a collection of functions that serve a common purpose.
- They’re important because they save you time when you work on a project.
- You can also create your own library and share it with others to spur innovation!
- Your Arduino library is located in the sketchbook folder, so if you want to access it, you’ll need to:
- Go to Preferences (ctrl + comma)
- Look for the address under the “Sketchbook Location”
- Following the address when you go through your files
- You can also find the examples associated with the libraries by either going to:
- The Github repository containing the library and clicking on the examples there, or
- The Arduino IDE and clicking File < Examples < “your library name”
You don’t have to get a library card to check these Arduino libraries out!