The Arduino Inventor's Guide (7 page)

BOOK: The Arduino Inventor's Guide
3.59Mb size Format: txt, pdf, ePub

If you don’t want to see prompts like this again, check the box that says you trust Arduino. Either way, click
Install
to install the USB drivers. That’s it! Arduino typically installs a shortcut on your desktop. Double-click that now to run the Arduino IDE.

Installing on OS X

If you’re using a Mac, download the Arduino IDE option for OS X, and follow the directions in this section.

Installing the IDE

After the download is complete, hover your cursor over your
Downloads
folder, and click
Open in Finder
as shown in
Figure 1-7
.

FIGURE 1-7:
After downloading, the program will be in the
Downloads
folder. Click
Open in Finder
to move it into the
Applications
folder.

Then, simply click and drag the
Arduino
program file into the
Applications
folder, as shown in
Figure 1-8
. In most cases, you won’t need to install anything else, and you should be able to open the Arduino IDE as you would any other program.

FIGURE 1-8:
Click and drag the
Arduino
file into the
Applications
folder on the left.

Installing the FTDI Driver Manually on OS X

If you’re using a standard Arduino Uno board, the drivers should be preinstalled and work out of the box. If you’re using the SparkFun RedBoard, there’s one extra step needed to manually install a driver. The SparkFun RedBoard uses a USB chip from Future Technology Devices International (FTDI) to communicate with your computer. You need to manually install the FTDI driver for this chip. First, navigate to
http://www.sparkfun.com/ftdi/
. This will take you to our tutorial on installing FTDI drivers (see
Figure 1-9
).

Click the link for Mac OS X. This will direct you to options for a driver to install based on the version of OS X running on your computer. There is one option if you have Mac OS X 10.3 (Panther) to 10.8 (Mountain Lion) and another option if you have Mac OS X 10.9 (Mavericks) or greater.

FIGURE 1-9:
SparkFun FTDI Installation Guide

Download the appropriate driver and double-click it to start the installation process. You should be greeted with the familiar Mac software install window. Select your hard drive once it is found, and click
OK
. Continue through the installation process, and when the progress bar fills up (as in
Figure 1-10
), the drivers should be installed.

FIGURE 1-10:
Installation of the FTDI drivers on OS X

That’s it! Now, double-click the Arduino icon in your
Applications
folder to run the IDE. If you’ve already opened the IDE before installing the FTDI drivers, you’ll need to fully exit and close out of the Arduino IDE and restart it for your serial ports to show up correctly.

NOTE

If you encounter an error after driver installation, check out solutions at
https://www.sparkfun.com/macdriver/
.

Installing on Linux

Arduino is available for Linux users, too. Download the correct Linux file for your system; it comes in 32- and 64-bit flavors. Then, uncompress the file using
xz-utils
or another file compression utility. If you want to use the latest version of Arduino in Linux, you may need to install some other dependency programs as well. Go to
http://playground.arduino.cc/Learning/Linux/
for distribution-specific information on this.

For most distributions of Linux (including Ubuntu, Debian, and Fedora), you should be able to use the
apt-get
package manager to install Arduino from the command line. Open a terminal and enter the following command:

sudo apt-get install arduino

Once the process is complete, open the Arduino program you just installed. Arduino uses Java to run the IDE and must be run out of an XWindows or comparable window user interface environment.

NOTE

Depending on the package manager for your distribution of Linux, the version you install this way may not be the latest version currently hosted on the Arduino site.

A BRIEF IDE TOUR

The IDE is a place for you to write instructions for your Arduino and test them out. These instructions form a program, or in Arduino terminology, a
sketch
. The IDE allows you to
upload
your sketch to your Arduino and control things in the physical world.

If you haven’t done so already, open your newly installed Arduino program. After a splash screen, you should see the IDE, which looks something like
Figure 1-11
.

FIGURE 1-11:
The Arduino IDE

You can use the menu bar (which consists of File, Edit, Sketch, Tools, and Help menus)

to open or save files, upload your code to the Arduino, modify settings, and so on. You should also see a set of graphic buttons

. In order from left to right, these are Verify/ Compile, Upload, New, Open, and Save. We will explore those menus and buttons throughout this book. The majority of the IDE is whitespace

; this is where you’ll write your code. Underneath the
code area is the
alert bar

, and below it you’ll find the console

; these report statuses, alerts, and errors. For example, if there’s a typo in your sketch (called a
syntax error
), the IDE will show you the error there. If you try typing your name in the code window and click the check mark (Verify/Compile) button, the Arduino IDE will think for a bit and then show an error in the alert bar, highlight your name, and give you more information in the console about the error, as you can see in
Figure 1-12
.

FIGURE 1-12:
A typical error message and readout in the Arduino IDE

CHANGING THE DEFAULT PREFERENCES

Arduino is a fully open and configurable programming environment. There are a few minor things we like to tweak in the preferences to make it easier to write code, debug, and make cool stuff. Select
File

Preferences
to view and change the general settings of the Arduino IDE. You should see a window similar to
Figure 1-13
.

We suggest adjusting the editor font size so it’s comfortable for you to read. We also like to check
Display line numbers
and uncheck
Save when verifying or uploading
. Line numbers will help you navigate around your code easier, and unchecking the auto-saving feature will allow you to quickly test code without having to save it each time. Arduino is completely open, so if you want to, you can also click the
preferences.txt
file and adjust many other features.

FIGURE 1-13:
Arduino Preferences window

TEST DRIVE: PLUGGING IN THE ARDUINO FOR THE FIRST TIME

When you have the Arduino IDE and drivers fully installed, connect your Arduino board to the USB port of your computer using the appropriate cable. The power LED should turn on, and if your board is completely new, you should see an LED, labeled 13, blinking as in
Figure 1-14
. Your computer is powering the Arduino board through the USB cable, and it’s running code that was installed at the factory. Unlike a computer, an Arduino can only store and run a single sketch at a time. The standard test sketch loaded onto an Arduino is a simple LED blink. With your board plugged in, you’ll set up the IDE so that you can write your own sketch.

Other books

Make Your Home Among Strangers by Jennine Capó Crucet
Paul Lynde - A Biography by Rudolph, Cathy
Beautiful Mess by Morgan, Lucy V.
B00528UTDS EBOK by Kennedy, Lorraine
Short Stories by W Somerset Maugham