The programming language used on the Arduino IDE is C+=, which is a common coding language across many platforms. There are a few key points you must be aware of before we begin programming on the software.
1. Global Scope - The global scope is an area which is not within a function. This is used to include libraries, assign variable names to analog/digital pins and choose data types. Anything declared in this area is called a global variable and can be read in every function within the program.
2. Void Setup - Every Arduino sketch has this function which runs an initial set of code to setup the program and only runs once at the start, until the board is restarted.
3. Void Loop - Every Arduino sketch has this function which contains the main instructions. This function repeats in a loop until the board is disconnected.
4. Serial Monitor - The serial monitor is a convenient feature which is the 'tether' between the Arduino and the computer. In this window, you can view what the Arduino is currently doing, as well as manually control the board using your computer. This is handy for debugging and we will be using this feature throughout our programming.
5. Comments - A good programmer regularly adds comments to their program to explain what is happening at a certain instruction. To add comments within your code simply type '//' followed by your comment. The text will be greyed out and not included within the code.
6. The 'Forgotten' Semi-Colon - When programming using C++, it is important to remember that at the end of each instruction line, you end with a semi-colon before proceeding, This can often be forgotten and causes compiler errors.