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?

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.

1
  • I installed this earlier today, and so far I'm liking it! I'm glad you pointed it out. I'll play with it a few more days before deciding to switch. – Jerry Nov 16 '15 at 19:53
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?

1
  • Thanks! That was a good link with lots of useful info. So far I'm liking the idea to include all the library files into the sketch folder. That will also help me with the problem of different sketches requiring different versions of a library. – Jerry Nov 15 '15 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.