PlatformIO Community

How to use the libraries that come with the Arduino IDE

I’ve seen others ask this same question and all of the answers do not fix nor do they address the problem. So here we go:
I’m taking a tutorial on Youtube and the instructor is using the Arduino IDE (which IMO sucks) this IDE comes with a few libraries that there is no need to add (i.e. Stepper.h). Now when I try to use this library it’s not available. When I look for the library that uses Stepper.h, it is not available in the Platformio libraries.
I tried using the lib_extra_dirs and I put this information in: C:\Users\babyg\Documents\PlatformIO\libraries - Didn’t work so I changed it to:
/Users/babyg/Documents/PlatformIO/libraries - Didn’t work so I went down to the stepper directory nope, then I went to the src directory and again this did not work.

I looked at that web page about Library Options, that is the most confusing slice of information it shows how to not use the directory down to where the files are and to use the generic directory where say all of your libraries will be hosted, but the example is nothing like what it tells you to use. The warning shows c: being used but then in the example it just says /common/library, where might this file be located? is it in the same file as the projects? or where Platformio is installed?
How do you use the lib_extras_deps?

These plain ole libraries that the Arduino has installed as part of their program, maybe Platformio should make those libraries available since most people who have started out on this path will need those libraries while they learn.

Stepper for arduino, like the other “built in” libraries, are available in PlatformIO.

In your platformio.ini, add:

lib_deps=stepper

This is the equivalent of “Sketch->Add Library” in the Arduino IDE.

Then build. The library will be downloaded and installed for the project.

That will add a local folder where one or more libraries can be found. The format should be:

Your_dir_name
    Library_name_1
        name.h
        name.cpp
        other.cpp
    Library_name_2
        ...
    Library_name_3
        ...

For libraries not included in the Arduino IDE, go to https://platformio.org/lib and search. Then add to lib_deps.

This explanation might help:

HTH

Cheers,
Norm.

Thank you so much! One other question is the included libraries typed in all lowercase, or does case matter? I want to uninstall the Arduino IDE (I need the drive space lol) but each time that I uninstall it, I always need to re-install it to check a sketch when it doesn’t run on Platformio but mainly when I need to figure out the library issues. Again thank you!

Library names are, or have been for me so far, case irrelevant. It can be any way you prefer.

Built inlibraries, for example, those that come with the Arduino IDE, servo, etc, just get written that way:

lib_deps=
    Servo,
    Wire,
    ...

The spacing is mandatory in the above, if you put all of the lib_dep on one line, the separator is comma space.

Other libraries should be added as:

lib_deps =
    Servo,
    NormanDunbar/cBuffer,
    Adafruit/whatever,
    ...

The publisher name is used to disambiguate duplicate names.

The library search page I mentioned above, has an installation tab to show how it can be installed.

Have fun.

Cheers,
Norm.