Appendix B. Coding primer

 

This coding primer is a basic guide to the Arduino language and how it’s used to create sketches that can be run on an Arduino. We’ll cover the following topics:

  • History of the Arduino language
  • Using variables
  • Using control statements
  • Using loops
  • Using functions

B.1. The Arduino language

The Arduino language is based on C/C++, and anyone who has previously studied C or C++ will readily be able to read the written code. If you haven’t studied C or C++ before, don’t worry. The Arduino language was designed to make coding as painless as possible, allowing you to concentrate on what can be done rather than how it’s done.

History of the Arduino language

Students at the Interactive Design Institute, Ivrea, the original home of Arduino, were taught to program using a language called Processing. The Processing design philosophy is to teach the fundamentals of programming within a visual context, and the Arduino team, realizing they needed to develop a language that made the prototyping of ideas as simple as possible, adopted a similar philosophy.

The decision was made to use the Processing IDE as the model for the Arduino IDE, because the original Arduino system was aimed at art and design students who were already familiar with Processing. The close links to Processing are still evident today, and any improvements made to the Processing IDE can be directly imported into the Arduino system.

B.2. Variables

B.3. Taking control

B.4. Going loopy

B.5. Functions

B.6. Summary