Arduino IDE library management (keeping all libraries in local folder help)

Thread Starter

zazas321

Joined Nov 29, 2015
936
Hello. I am developing a program for ESP32 device. When I program in Arduino IDE, I just usually create multiple .ino file which then are merged to a single file when I program my devices, my program folder usually looks like:
1618202845686.png

That works fine, but I am now trying to practise a different library management method where I have a single .ino file (I considered it as a main.c ) and then I am going to create source and header files for different parts of my device. For example for all the wifi code, I will have wifi.c and wifi.h and etc.

I have started a new project and inside a directory, I have created a src folder, where I am going to keep all source and header files:
1618202989240.png

Now, I want to program LIS3DH accelerometer device and create a seperate source and header files for it. I have use an Arduino adafruit library for that and this library is saved in my arduino default libraries folder (the code also has many dependancies as you can see)
1618203088737.png


Now, I am struggling to understand what is the best way to use this library in my local project directory?
I have copied all the required files from arduino/libraries and added them to my project /src folder. Now I have many conflicting error libraries:
1618203283552.png


Do I must delete all the libraries from arduino/libraries folder for that to work or there is another way to overcome this?
 

Attachments

Ya’akov

Joined Jan 27, 2019
9,154
I don't know if this is the best way, but you could rename the libraries in the main libraries folders with some element like:

<library>-master.h

And when you copy it to your project folder, drop -master. I don't think that project folders would be searched when other projects are compiled.
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
I suppose thats one way of doing it.. What is generaly best practise for managing arduino library folders? Is it okay to create many .ino tabs?

The only issue I have with that, when I want to use my code on another machine, I have to download all the libraries that I used for this program which is quiet annoying sometimes.
 

Ya’akov

Joined Jan 27, 2019
9,154
I suppose thats one way of doing it.. What is generaly best practise for managing arduino library folders? Is it okay to create many .ino tabs?

The only issue I have with that, when I want to use my code on another machine, I have to download all the libraries that I used for this program which is quiet annoying sometimes.
Frankly, I haven’t investigated the library management of the Arduino IDE very deeply. The IDE is a bit primitive, and the paths, etc., are obscure. I have to learn more because while I haven’t really hit limits yet, sometimes installing things makes a mess.

I might have to write a few scripts to handle includes, which isn’t a big deal.
 
Top