How do I add libraries after importing an Arduino sketch

Have you tried the ‘New Topic’ button?

image

I’ve split this into a new topic.

You can use the lib_extra_dirs parameter in your platformio.ini if you want to include your existing sketchbook libraries folder in the list of folders that the PlatformIO library depenency finder will look in. Click the link to see the documentation for that parameter.

But, it is better to get familar with the PlatformIO way of managing libraries, as it gives you a lot more control over them. You basically need to search for the library in the platformio registry, so you can put the correct name in your platformio.ini’s lib_deps line. Do NOT use the install button in the library manager, as that installs the library into global storage - which you do not want to do unless you know what you are doing.

i.e.

  1. click the platformio sidebar icon
  2. open the pio home libraries view and search for your library
  3. once you’ve found your library, click on the installation tab for it
  4. here is your lib_deps entry for that particular library

You should have only one lib_deps entry, which can list multiple libraries, as well as lock them to specific versions if needed. Click the link to see the documentation for that parameter.

1 Like