Background-
The Arduino IDE is popular among artists, tinkerers, designers and programmers alike for its simple learning curve and integrated serial monitor. While there are cloud-based alternatives like codebender.cc and rumors of an officially supported cloud-based IDE have circulated for the past year or so, most Arduino development takes place on a local machine. As I find myself migrating between different machines and operating systems frequently, this has occasionally caused problems when I needed to update the source code on a specific device but couldn't find the original file. On other occasions a sketch wouldn't compile on one machine when it worked fine on another due to the way the IDE keeps track of code libraries.
As of Arduino version 1.6.6, the IDE ships with a new library management system that syncs with the cloud to allow users which version to choose. This feature still has its bugs to be sure, but it opens any new possibilities which would've caused too many problems in earlier versions.
With an eye towards future capabilities, I've decided to experiment with my own development workflow which would allow me to create a master Arduino sketchbook that can be synchronized with any local machine over the cloud. While I've seen examples of standard cloud storage tools like Google Drive or Dropbox being used for this purpose, I chose Github for its powerful features as it is first and foremost a version-control platform. Beyond a programmer-centric syntax which might be intimidating to non-developers, the only major drawback to using Github for this purpose is in the fact that all content is public under the free version. This could cause problems with sketches containing personal information like API keys, passwords etc... but such information should be used with caution anyway (My solution was to create a private spreadsheet on Google Drive with the sensitive data entered next to the sketch URL on Github). I also made sure to include a disclaimer on the readme.md file explaining that the sketches are often incomplete and are works in progress.
Set up-
Once I created my master sketchbook repository on Github, the next step was to synchronize it with my local machines. On my Linux desktop that I use as my primary development machine, I first cloned the repository with the "git clone- url" command. Next, under Arduino-> File -> Preferences, I changed the sketchbook location path to match the cloned repository. Then I simply copied and pasted all of the sketches from the old sketchbook folder into the new one.
Under Linux Ubuntu, it will detect duplicate files and ask if you would like to automatically replace any duplicates with the most recent version. This should automatically update any outdated libraries under the sketchbook/libraries path, though I still had to manually remove some.
Once the manual import is completed, I opened the terminal in the new sketchbook folder, added all the new files with "git add -A" and "git commit -a" before making note of the changes in the commit and finally "git push origin master".
In the case of Windows and Mac, Github has a desktop client and in such cases it was as simple as using the client to clone the master sketchbook repo and changing the Arduino preferences to match the new location.
Synchronization and Next Steps-
From now on the toughest part is going to be remembering to commit any local changes I make at the end of my session. This process is pretty straight forward with the Desktop app, but I might need to look into various scripts that automate the process on Linux. Or at the very least set up a reminder widget.
The real value of such a workflow is not so much in the cloud sync capability, as this in of itself might be better accomplished with a dedicated cloud host service like Google Drive. The value is in getting a head start on an organizational method that will be much more standard in the near future as the official IDE starts to resemble cloud services like codebender.cc and Cloud9. Furthermore, the main drawback to the method (i.e the fact that the files will be public) can also be an advantage if properly configured to invite new collaborators.
With an eye towards these future developments, my current plan is to integrate the master sketchbook repo into other cloud services like codebender. I would also like to create a "Production Branch" consisting of completed sketches which can be or are used in projects documented at hackster.io, blogs etc... These sketches can then be further packaged using the Github Gists feature allowing for public contributions on a per-project basis.
Another possibility would be to actually host the source running on connected Arduino hardware using the GIST feature. There is a tool allowing for such a setup at- https://github.com/davidvondle/Upload-And-Retrieve-Source though it hasn't been updated since 2012...
Do you use Github in your Arduino Development? If so please do share your observations in the comments! Any other suggestions or questions are also welcome!
Comments
Please log in or sign up to comment.