I create a library, which named “SR04”, according to my arduino textbook:
Is there anyway to add this library to my platformio ide?
Best regards.
Yes. There are several options:
(For the description, it is assumed that the files shown in your post reside in C:\Users\wgt\Documents\SR04)
Option 1: lib_deps
In your platformio.ini
file, add:
lib_deps = file:///C:/Users/wgt/Documents/SR04
Option 2: Copy to lib directory
Copy the SR04 directory into the lib directory within your project folder.
Option 3: Git submodule
If both your project and the your library is part of a Git repository, you can use git submodules:
In the project directory, run:
git submodule add https://github.com/wgt/SR04.git lib/SR04
git submodule update --init --recursive
2 Likes