arduino打开库文件

您所在的位置:网站首页 arduino下载的库在哪 arduino打开库文件

arduino打开库文件

#arduino打开库文件| 来源: 网络整理| 查看: 265

安装Arduino附加库

当你用着Arduino或者内建函数比较舒服的时候,你可能希望扩展你的Arduino 附加库。

附加库是什么?

附加库是一个代码的集合,可以让你方便的连接一台传感器、显示器、模组等等。比如,内建库LiquidCrystal 库使得在LCD上显示字符变得方便。在网络上,有成百上千的附加库可供下载。内建库和一些附加库在链接https://www.arduino.cc/reference/en/libraries/中,这些附加库只有安装后才能使用它们。

库安装方法 1)使用库管理器

可以采用库管理器的方式为Arduino IDE安装一个新库(Arduino IDE v1.6.2以后的版本支持)。打开IDE,点击"Sketch"(项目)> Include Library(加载库) > Manage Libraries(管理库),如下图所示。

LibraryManager 1 库管理器打开后,可以看到一个已经安装或可以安装的库列表。在本例中,我们将安装Bridge 库。在列表中找到该库,点击它并在版本选择菜单中选择将要安装的版本,如下图所示。在某些时候,某些库只有一个版本可选。因此,如果选择菜单没有出现,也很正常。 LibraryManager 2 点击安装,并等待IDE完成该新库的安装。基于网络连接速度,下载可能会花费一些时间。安装完成后,会有一个深绿色的“INSTALLED”标签出现在Bridge库上。这时,可以关闭库管理器。 LibraryManager 3 可以在Sketch(项目) > Include Library(加载库)菜单中找到刚才安装的新库。如果要安装自己的库到库管理其中,参考链接https://github.com/arduino/library-registry/blob/main/FAQ.md#readme中的内容。

2)导入 .zip格式的库

库一般表现为ZIP文件或文件夹。文件夹的名称一般为库名,文件夹内部一般包括一个.cpp文件和一个.h文件,通常还会有一个关键字.txt文件、示例文件夹,以及该库的其他依赖文件。从Arduino IDE 1.0.5开始,可以安装第三方库。不要解压zip文件,保持它的原始状态。

在Arduino IDE中, Sketch(项目) > Include Library(加载库) > Add .ZIP Library(添加.ZIP库)。

ImportLibraryFromZIPFile

准确的选择要添加的库。导航到.zip文件的位置并打开它。

SelectLibraryZip 返回Sketch(项目) > Include Library(加载库),可以看到将要安装的库位于下拉菜单的底部。该库已经可以用于项目中。该库的zip文件已经解压到Arduino项目目录下的库文件夹。

注意:该库可以用于项目中,但是在旧版本IDE示例中,该库直到IDE重启之前,不会出现在File (文件)> Examples(示例)中

3)手动安装

When you want to add a library manually, you need to download it as a ZIP file, expand it and put in the proper directory. The ZIP file contains all you need, including usage examples if the author has provided them. The library manager is designed to install this ZIP file automatically as explained in the former chapter, but there are cases where you may want to perform the installation process manually and put the library in the libraries folder of your sketchbook by yourself.

You can find or change the location of your sketchbook folder at File > Preferences > Sketchbook location.

Sketchbook Prefs

Go to the directory where you have downloaded the ZIP file of the library

Lib ZIP 1

Extract the ZIP file with all its folder structure in a temporary folder, then select the main folder, that should have the library name

Lib ZIP 2

Copy it in the “libraries” folder inside your sketchbook.

Lib ZIP 3

Start the Arduino Software (IDE), go to Sketch > Include Library. Verify that the library you just added is available in the list.

Lib ZIP 4

Please note: Arduino libraries are managed in three different places: inside the IDE installation folder, inside the core folder and in the libraries folder inside your sketchbook. The way libraries are chosen during compilation is designed to allow the update of libraries present in the distribution. This means that placing a library in the “libraries” folder in your sketchbook overrides the other libraries versions.

The same happens for the libraries present in additional cores installations. It is also important to note that the version of the library you put in your sketchbook may be lower than the one in the distribution or core folders, nevertheless it will be the one used during compilation. When you select a specific core for your board, the libraries present in the core’s folder are used instead of the same libraries present in the IDE distribution folder.

Last, but not least important is the way the Arduino Software (IDE) upgrades itself: all the files in Programs/Arduino (or the folder where you installed the IDE) are deleted and a new folder is created with fresh content. This is why we recommend that you only install libraries to the sketchbook folder so they are not deleted during the Arduino IDE update process.

cited:https://www.arduino.cc/en/Guide/Libraries



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3