1

I have a complex sketch that I spent many weeks working on, which I am backing up frequently because I'm afraid of losing any of my progress.

I'm wondering if it's common practice to make a self-contained package of the sketch and all its dependencies, so that it can be moved easily to another OS if necessary. My concern is that if my OS crashes and I have to reinstall everything or move to another OS, I might run into library and dependency errors, especially with the libraries that I altered/customized. I need my sketch to be able to compile as quickly as possible on whatever OS I end up using, since it's a home-automation sketch that controls dozens of things around me.

Is this a valid concern? And if so, what are some preferred ways to make a sketch become "self-contained", so that everything necessary is included? Is there some kind of a better version-control system for Arduino sketches that an amateur programmer might not be aware of?

dda
  • 1,595
  • 1
  • 12
  • 17
Jerry
  • 533
  • 1
  • 6
  • 21

2 Answers2

2

I would suggest switching to UECIDE instead of the Arduino IDE. (Yes, shameless plug, it's my IDE).

UECIDE has a facility that I dubbed "localizing" a library whereby it copies it into a libraries folder within the sketch folder itself, and that copy of the library is used in preference to any other library named the same in the system.

That means that a sketch and its libraries then become completely self contained in one folder, and it's perfectly possible to have different versions of the same library in different sketches.

Majenko
  • 105,851
  • 5
  • 82
  • 139
1

A way to do so is to include all the library files (*.cpp, *.h) in your sketch folder and then include them in your code.

There are many solutions that you might find handy in this link: How to organize my Arduino projects' structure for easy source control?

Ikbel
  • 620
  • 4
  • 13