I've been going through the forums and I see a lot of people discussing including libraries from sub-folders and the ultimate thing I always see is to go to Arduino Libraries spec.
If this question has an answer already please show me the post that answers it.
I want to have a github repo where I store all my libraries for many courses that I teach that use the arduino as well as many sensors. Lots of the courses are control systems related so there are a lot of libraries for interfacing with sensors as well as math utility libraries that I would like to have all in one repo so students can have one central location with all necessary libraries for any courses they may take in the future.
The question is, how can I easily setup the following heirarchy of directories and still let arduino access the libraries. I usually have my students change their sketchbook location to the repository directory that way any changes made can be easily pulled from github, and they can also easily make their own changes to their own copy of the repo if need be. The main difference I see from this and other questions is that I want to group my libraries by how they are related, not just all stuffed into the libraries folder.
│ │ Differentiator.cpp
│ │ Differentiator.h
I've seen discussion on using PATH variables for the compiler but haven't really dove into that, and plus that might be complex for some of the younger students I teach.
Curious if there are any simple solutions out there for this!
how can I easily setup the following heirarchy of directories and still let arduino access the libraries.
Each library must be in a subfolder directly under the libraries folder. If you're using the Arduino IDE, there isn't really an easy way to get a different structure.
You could use symlinks, but those are not not very easy for Windows users to work with.
You could turn your category folders into libraries with the recursive (AKA "1.5") format, with the true libraries bundled in subfolders under the library's src folder, but this will cause all the bundled libraries to be compiled (of course subject to optimization, but might have some implications regardless).
If you're using Arduino CLI, you can use the
arduino-cli compile --libraries flag to specify additional libraries directories. So you could set the
math_util, and sensors folders as libraries folders.
I'm not really convinced that you're doing your students any favors by teaching them with Arduino, but not teaching them to use the Arduino framework in the standard manner. It's all well and good for you and me to have fun making the Arduino framework do interesting things, but I'd think a student has enough to think about just with learning programming, electronics, and Git. I doubt they're terribly concerned with having their libraries sorted into folders by category.
The alternative I'll propose is for you to use the Arduino Library Manager. You can define dependencies of a library via the library.properties depends field, and this will cause Library Manager to offer to install all the dependencies at the same time. So the student only needs to install a single library and then they get the full set of libraries for the course along with it. You can define the category of the library in its metadata
But of course you're the professor so you're best able to decide what is best for your students. If you need any additional information about any of the ideas I mentioned, I'm happy to help out.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.