Arduino software

From Elcano Project Wiki
Revision as of 01:52, 10 October 2019 by Ptressel (talk | contribs)
Jump to navigation Jump to search

Development tools

In Arduino terminology, a program that runs on an Arduino is called a sketch. These are written in a limited version of C++, described here: https://www.arduino.cc/reference/en/ . In addition, one can include libraries, which are written in C++. If there is code that would be useful to share between sketches, it can be put in a library. Many open-source libraries are available for Arduino -- this lists some popular ones: https://www.arduino.cc/en/reference/libraries

There are several IDEs that support Arduino development:

It's recommended to start with the Arduino IDE as it's simpler and most Arduino information online assumes you are using it.

Arduino software structure

We have some local software conventions, mainly due to the fact that some settings and code need to be shared between different projects that run on different Arduinos.

Settings.h

This file contains information that is different per vehicle. This includes mechanical information (e.g. wheel diameter, turning radius, etc.) and electrical information (e.g. pin assignments). It is required by most projects. All the rest of the code should be written to be portable across a wide variety of vehicles.

A template version of this file, called SettingsTemplate.h, is packaged as a library, and is available in the General repository. SettingsTemplate.h should be copied to Settings.h, and local changes made in Settings.h as needed. Anything of general use can be put back into SettingsTemplate.h. Note this division between a template version of settings and a personalized version is the same division as is found with most application preferences or configuration files.