The most suitable microcontroller choices for a beginner are Basic Stamp and Arduino. Basic Stamp has existed since the early 1990s and has become popular among hobbyists. It uses the Basic programming language, which is easy to use but somewhat limited compared to the C language used by Arduino
Starting with Arduino
Arduino is available in a few different models. This book covers the aforementioned Arduino Uno and Arduino Nano. Uno is an inexpensive (around $30) and sturdy basic model, and is the most current version of the board. It was released publicly in September 2010 and is the successor to the Arduino Diecimila and Arduino Duemilanove.
First, you have to buy an Arduino and a compatible USB cable. Uno and Nano communicate to your computer via USB (for uploading new programs or sending messages back and forth). They can also take their power over USB. Uno uses a USB-B cable and Nano uses a Mini-B, and each connects to the computer with a USB-A male connector.
Installing Arduino Software
Next, you need to install the Arduino development environment for your operating system and compile the first test program. This “Hello World” code is the most important part of getting started with a new device. Once you are able to compile simple, light-blinking code in Arduino, the rest is easy.
The examples in this book were tested with version 0021 of the Arduino development environment. If you decide to use some other version, the installation routine might differ.
Structure of “Hello World”
You just took an important step by running the “Hello World” of Arduino: Blink. The program blinks an internal LED on the Arduino. If you can get the LED to blink, you can be confident that you can compile and upload programs to Arduino.
All Arduino programs have a similar structure. Since Blink is a simple program, it is easy to understand the program structure by examining it. Here is the source code for Blink, which comes with Arduino but is offered here with our commentary
The Arduino Nano is considerably smaller than the Uno mentioned earlier. It also has pins that you can connect straight onto a prototyping breadboard. These allow you to easily construct even quite complex circuits without soldering.
Nano is more expensive and sensitive than Uno. For example, a certain kind of short circuit will break Nano permanently. Another downside is that it is harder to read the markings on the pins, making it easier to misplace wires. With the addition of a mini breadboard and retractable USB cable, the Arduino Nano becomes part of a handy travel pack.