Now that you are familiar with the Arduino IDE and how to create, edit, and upload a program, this chapter will now turn your focus to the HW. You'll get a chance to learn how to connect to and access the capabilities of the general purpose input/output (GPIO) pins from the SW. In this chapter, I'll start by explaining the GPIO pins, what they can and can't do, and then show you how to make Arduino access the outside world with the help of some very basic circuits and very simple programming examples.
Arduino was built to access the outside world. Much of that access is through the GPIO pins. Each Arduino board has a different set of GPIO pins, so in this section, I'll provide details on the GPIO pins available on the most common variant of Arduino: Arduino Uno. Then, I'll also document the additional capability of the Arduino Mega. Finally, I'll show the GPIO capability of a more limited Arduino: Arduino FLORA.
First, let's focus on the Arduino Uno. As described in Chapter 1, Powering on Arduino, the Arduino Uno comes with a set of 14 digital and six analog I/O pins, along with some additional pins to provide power and serial I/O.
Fortunately, the pins are actually well labeled on the board itself, as shown in the following image:
The following table shows a list of pins that are available and a brief description of what each pin can do, starting at the upper-right side of the board and going clockwise. A more in-depth description of these pins will come later as you actually use them in some example projects:
The Mega provides a bit more from an I/O pin perspective. The following image shows the Arduino board:
You'll first notice that the pins on the left side of the Arduino Mega are labeled the same as with the Arduino Uno. And they do have the same functionality. However, you'll also notice some additional pins on the right side of the board. The following table provides a brief explanation of the most useful pins, starting at the upper-right side of the board and going clockwise:
The FLORA, being a much smaller package, provides a different set of pins. The following image shows the FLORA:
The following table gives a description of the pins available, starting at the upper-left side of the board just above the USB connector:
3.144.47.218