Sketchbook location, nested libraries from different repositories

Hello All,

I'm trying to integrate multiple libraries from various projects that are across multiple repositories into the libraries folder of my sketchbook.

For example, I have a project that automatically heats an incubator with PID control, and I've written a PID control library that I'd like to use across other types of projects (think DC motor velocity control for example). I'd like to have separate repositories for the "core" libraries that are shared across these projects that are separate from the sketches and libraries made custom for that specific project (think config.h files for various projects).

How can I go about having the following directory strcuture while still being able to simply call
#include <odom.h> for example?
The main goal is to be able to edit core libraries and not have to always shuffle around all of these libraries each time I made an edit, a simple git pull will update the library (and of course you'll need to do any hot fixes if any bugs come up, or just have different branches for different edits if necessary). I'd prefer to not have to have a repo for each library, but if that's the only way then I guess I'll try and find another work around.

D:\arduino_code_test
├───libraries
│   ├───custom_lib_for_this_projects
│   ├───libs1
│   │   ├───.git
│   │   ├───Differentiator
│   │   ├───HC_SR04
│   │   ├───odom
│   │   └───PID_beard
│   └───libs2
│       └───.git
└───sketches

Hopefully my idea makes sense. If not, is there a way to have the arduino IDE compiler look at multiple folders for libraries? That way I can have the compiler look at my sketchbook location but also look at a "general libraries" folder as well?

I realize I've asked the exact same question a year ago HAHA.

It was closed due to inactivity.

Is this still not a possible feature? (I don't want to use SYMLINKS for example)

You could put custom_lib_for_this_projects under the src subfolder of your project sketch and then make D:\arduino_code_test\libraries be the "core libraries" Git repository.

You can set the sketchbook location (D:\arduino_code_test in this example) via the File > Preferences > Sketchbook location preference in the Arduino IDE (or also configurable via the command line or by directly editing the preferences file), so you can switch between multiple sketchbooks if needed.

I was seeing this around. I was hoping to still be able to have a structure like above in my example in the libraries folder.

Maybe I can just move all the subdirectories I want into the sketches/src folder and have individual repos in there. I'm going to play around with this! Thank you!

You are welcome. I'm glad if I was able to be of assistance.

I'd be interested to learn which approach you finally settle on.

Hi in0,

So this works if I want to have the libraries inside a single sketch directory. For example:

arduino_code/sketches/my_sketch_1/src

arduino_code is my sketchbook location in this example.

This works but it does not achieve my main goal which is to have a library for a bunch of different sketches. For examples in the sketches directory there might be 20 or so different sketches. I wouldn't want to copy all the libraries into each 'src' directory inside each individual sketch. Putting a 'src' directory into the sketches directory directly does not work unfortunately.

So I'm still stuck at trying to find a way to consolidate multiple libraries into one directory that is inside the arduino_code/libraries directory such that I don't need that folder to be named the same as the .h file.

Installing .zip libraries directory into the arduino/libraries directory (not my sketchbook) brings up the problem of needing to delete the .zip file each time there's an update.

So i'm still at a loss, any ideas?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.