How to correctly specify libraries in platformio.ini?

Hi all,
Using Platformio via VSCode. I’ve read that the best way to specify libraries would be to add them to platformio.ini. So I tried something like this (which works)

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
ESP32 BLE Arduino

However, if I try to add more libraries to clean up my code a little, removing this in my main.cpp

// in main.cpp
#include <Arduino.h>
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>

and modify my platformio.ini like this …

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
# Using a library name
Arduino
ESP32 BLE Arduino
BLEDevice
BLEServer
BLEUtils
BLE2902

Then I cannot get my sketh to compile and intellisense complains about not finding anything (which gives also some not so nice red squigglies everywhere)

What am I doing wrong?

Please read Redirecting...

lib_deps is intended to download external libraries.

Thanks for the super fast feedback.
So would it be correct to remove Arduino from platformio.ini but still keep the other ones?

This is a valid config

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
  ESP32 BLE Arduino

and in CPP

// in main.cpp
#include <Arduino.h>
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>

Hi,

Ok, thanks for the clarification. So best practice would be to use that only for libraries that need to be procured over the net and keep all the rest in the sketch file, correct?

1 Like