platformio添加外部库文件方法

方法1

platformio添加外部库文件方法_第1张图片
在这里搜索所需要的库函数进行添加到工程里

方法2(常用)

1.准备好所需要的库文件
2.打开工程文件夹
platformio添加外部库文件方法_第2张图片
platformio添加外部库文件方法_第3张图片
platformio添加外部库文件方法_第4张图片
platformio添加外部库文件方法_第5张图片
完成以上4步后,重启VScode,即可完成库文件添加

方法3(常用)

当创建完工程后,在该工程中添加库,方法2是添加全局库的方法,添加后其他工程也可以直接调用,方法3添加后只适用于当前工程
1.打开当前工程文件夹
platformio添加外部库文件方法_第6张图片
在这里插入图片描述
在这里插入图片描述
platformio添加外部库文件方法_第7张图片

方法4(更新)

把需要用到的库文件直接放进lib中就行不会报错
官方例程

For example, see a structure of the following two libraries `Foo` and `Bar`:
 
|--lib
|  |
|  |--Bar
|  |  |--docs
|  |  |--examples
|  |  |--src
|  |     |- Bar.c
|  |     |- Bar.h
|  |  |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|  |
|  |--Foo
|  |  |- Foo.c
|  |  |- Foo.h
|  |
|  |- README --> THIS FILE
|
|- platformio.ini
|--src
   |- main.c
 
and a contents of `src/main.c`:

#include 
#include 
 
int main (void)
{

}

你可能感兴趣的:(硬件工程开发学习笔记,arduino,c语言)