Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Maik Schmidt - Arduino A Quick-Start Guide, 2nd Edition (The Pragmatic Programmers) - 2015.pdf
Скачиваний:
146
Добавлен:
22.03.2016
Размер:
30.47 Mб
Скачать

Chapter 1. Welcome to the Arduino 10

All of these pins are connected to a microcontroller, which combines a CPU with some peripheral functions, such as IO channels. Many different types of microcontrollers are available, but the majority of Arduinos usually come with an ATmega328, an 8-bit microcontroller produced by a company named Atmel. Still there are Arduino models—for example, the Arduino Mega or the Arduino Due—that use more powerful microcontrollers.

Although modern computers load programs from a hard drive, microcontrollers usually have to be programmed. That means you have to load your software into the microcontroller via a cable, and once the program has been uploaded, it stays in the microcontroller until it gets overwritten with a new program. Whenever you supply power to the Arduino, the program currently stored in its microcontroller gets executed automatically. Sometimes you want the Arduino to start right from the beginning. With the reset button on the right side of the board, you can do that. If you press it, everything gets reinitialized, and the program stored in the microcontroller starts again. (We’ll use it in

First Version of a Binary Die, on page 45.)

On most Arduino boards you’ll also find a couple of LEDs. You’ll learn more about them in Hello, World!, on page 16.

Installing the Arduino IDE

To make it as easy as possible to get started with the Arduino, the developers have created a simple but useful integrated development environment (IDE). It runs on many different operating systems. Before you can create your first projects, you have to install it.

Important note: at the time of this writing, two different versions of the IDE are available (1.0.6 and 1.6.0).8 Chances are good that the 1.0.x branch of the Arduino IDE will no longer be maintained in the future. So, you should use 1.6.x where possible and use 1.0.x only if you need to use libraries that don’t work on 1.6.x yet. The following instructions refer to the 1.6.0 version.

Installing the Arduino IDE on Windows

The Arduino IDE runs on all the latest versions of Microsoft Windows, such as Windows 8.1 and Windows 7. The software comes in two flavors: as a Windows installer or as a self-contained zip archive. Check the Arduino’s download page9 for the latest version of either one.

8.There’s even one more for the Arduino Galileo at https://communities.intel.com/docs/DOC-22226.

9.http://arduino.cc/en/Main/Software

report erratum • discuss

Installing the Arduino IDE 11

If you have administrative privileges on your machine, use the installer because it installs not only the IDE, but also all the drivers you need. In this case you usually don’t need anything else and can use the IDE right away.

If you don’t have administrative privileges, download the zip archive and extract it to a location of your choice. Before you first start the IDE, you must install drivers for the Arduino’s USB port. This process depends on the Arduino board you’re using and on your flavor of Windows.

Installing the Drivers for Current Arduino Boards

To install drivers for recent boards, such as the Arduino Uno, plug the Arduino into a USB port first to start the automatic driver installation process. This process will likely fail, and you’ll have to open the system Control Panel and start the Device Manager. (You can find it under System and Security.)10 In the

Ports (COM & LPT) section, you’ll probably find an entry named

Arduino Uno (COMxx).

If you can’t find that entry, search for Unknown Device in the

Other Devices menu—Figure 3,

Sometimes the Arduino isn't recognized, on page 12.

Right-click the entry belonging to the Arduino board and choose Update Driver Software. Select the Browse My Computer for Driver Software option. Go to the drivers folder of the archive you’ve extracted and select the arduino.inf file. (See Figure 4, The content of the drivers folder, on page 12.) In older versions of the IDE the file was named Arduino Uno.inf.

After you’ve installed the driver, you can start the Arduino IDE and work with the board. (If you’re running Windows 8.x, you have to disable some protection mechanisms before you install the driver.)11

10.http://windows.microsoft.com/en-us/windows/open-device-manager#1TC=windows-7

11.https://learn.sparkfun.com/tutorials/installing-arduino-ide/windows

report erratum • discuss

Chapter 1. Welcome to the Arduino 12

Figure 3—Sometimes the Arduino isn’t recognized.

Figure 4—The content of the drivers folder

report erratum • discuss

Installing the Arduino IDE 13

Installing the Drivers for Older Arduino Boards

Driver installation for older boards like the Duemilanove, Diecimila, or Nano is a bit different. Still, you have to plug in the board first.

On Windows Vista, driver installation usually happens automatically. Lean back and watch the hardware wizard’s messages pass by until it says you can use the newly installed USB hardware.

Windows 8.x, Windows 7, and Windows XP may not find the drivers on Microsoft’s update sites automatically. Sooner or later, the hardware wizard asks you for the path to the right drivers after you have told it to skip automatic driver installation from the Internet. Depending on your Arduino board, you have to point it to the right location in the Arduino installation directo- ry—that is the drivers/FTDI USB Drivers directory.

After the drivers have been installed, you can start the Arduino executable from the archive’s main directory by double-clicking it.

Please note that the USB drivers don’t change as often as the Arduino IDE. Whenever you install a new version of the IDE, check whether you have to install new drivers, too. Usually it isn’t necessary.

Installing the Arduino IDE on Mac OS X

The Arduino IDE is available as a zip file for Mac OS X.12 The IDE depends on the Java Virtual Machine, and at the time of this writing it’s available for Java 6 (recommended) and Java 7 (experimental). Download it, double-click it, and drag the Arduino icon to your Applications folder. If you hadn’t installed Java already, Mac OS X will ask you for permission to install it.

If you’re using an Arduino Uno or an Arduino Mega 2560, you are done and can start the IDE. Before you can use the IDE with an older Arduino, such as the Duemilanove, Diecimila, or Nano, you have to install drivers for the Arduino’s serial port. You can find the latest version online.13 Download the package for your platform (it usually has a name such as FTDIUSBSerialDriver_10_4_10_5_10_6.mpkg), double-click it, and follow the installation instructions on the screen.

When installing a new version of the Arduino IDE, you usually don’t have to install the drivers again (only when more recent drivers are available).

12.http://arduino.cc/en/Main/Software

13.http://www.ftdichip.com/Drivers/VCP.htm

report erratum • discuss

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]