Arduino libraryď
A large part of the reason why Arduino is so popular with the public is that it has a huge open source library file. You only need to download the relevant library file according to the function, and then copy it to the relevant folder to program quickly. Because various functional functions have been integrated in the library file, the desired function can be realized by calling related functions as required.
What is arduino library?ď
Arduino library files contain at least one header file (xxx.h) and none or multiple source files (xxx.c or xxx.cpp). After successfully installing the library, include the headers from the library via â#include <xxx.h>â in the arduino file (xxx.ino). As follows:
#include<LED.h>
LED led(10);
void setup() {
}
void loop() {
led.on();
delay(300);
led.off();
delay(300);
}
Tip
If you want to learn how to make an arduino library, click me; Otherwise, skip to the next section!
Installing librariesď
Tip
Here are two ways to install the library, choose the one that suits you!
Importing a .zip libraryď
Select the âxxx.zipâ library file to load into the Arduino IDE:
Manual installationď
When you want to add a library manually, you need to download it as a ZIP file, Unzip it and put it in the libraries folder of your sketchbook by yourself.
You can find or change the location of your sketchbook folder at âFile > Preferences > Sketchbook > Settingsâ location:
Tip
The vast majority of custom libraries (also known as contribution libraries) are stored in files under this path!
(Optional) other library file storage paths(Windows system):
C:\Users\Administrator\AppData\Local\Arduino15
Go to the directory where you have downloaded the ZIP file of the library Unzip the ZIP file and copy it into the âlibrariesâ folder inside your sketchbook.
Tip
âxxxâ is the name of the library file!
Installation successfulď
Start the Arduino Software (IDE), go to âSketch > Include Libraryâ. Verify that the library you just added is available in the list.
Tip
âxxxâ is the name of the library file!
Uninstalling an arduino Libraryď
Uninstalling an Arduino Library is simpler than installing it. Find the sketchbook folder on your computer (same as in the âManual installationâ chapter). Go to the location and open the âlibrariesâ folder. Select the folder containing the library you want to delete, and then simply delete it. Next time you open your Arduino IDE, there wonât be the deleted library under the âSketchâ > âInclude Libraryâ menu.
Libraries donât take much space and most of the time there is no reason to remove them. If you donât intend to use them again, though, and want to declutter the list, you can safely delete them. You can always install any Arduino Library again if you need to use it in the future.
Otherď
For other methods, see (Option): https://www.arduino.cc/en/Guide/Libraries
End!