Can't add the AFMotor library for an Arduino project

My project in Platformio doesn’t recognize the library #include <AFMotor.h>. I have tried the following based on ohter comments in this community and the documentation about libraries rom platformio, but still can’t get it work.

  • Add the library in the “platformio.ini” file as “lib_deps = adafruit/Adafruit Motor Shield library @ ^1.0.1”, not working
  • Edit the “include path” setting, even add the Arduino IDE library directory where the library is installed and nothing
  • Install the library from the platformio GUI only in the environment of my project also nothing

The library works perfectly in the “Arduino IDE” so I don’t know why Platformio doesn’t recognize it. I hope someone can help.

Cheers,
JG

Ctrl+Shift+P → Rebuild IntelliSense.

Assuming you have the library in lib_deps.

Thank you Max, still same issue… below the screenshot of the lib_deps in case I’m doing something wrong there… I copied that from the GUI libraries “installation” tab

Please post your full platformio.ini.

Have you also switched to the correct project and environment using the project environment switcher?

Here is the full platform.ini, you were right, as soon as I changed from “default” to “env:uno” it recognized the library. Should I always use the “env” instead of the default? I’m assuming defaul is sort of shared among all the projects/environmets?

Thank you for your time max, really appreciate the help.

Either you had multiple PlatformIO projects in your VSCode workspace and just didn’t select the new one or selecting the uno environment triggered an IntelliSense refresh and made it work. The default environment of the correct project should also work, since your project’s default (and only) environment is the uno one.

1 Like