實驗物理技術:2009/02-06
登入

How To Get Arduino Running on Windows

This document explains how to connect your Arduino board to the computer and upload your first sketch.

These are the steps that we'll go through:

  1. Get an Arduino board and cable
  2. Download the Arduino environment
  3. Install the USB drivers
  4. Connect the board
  5. Connect an LED
  6. Run the Arduino environment
  7. Upload a program
  8. Look for the blinking LED
  9. Learn to use Arduino

1 | Get an Arduino board and cable

In this tutorial, we assume you're using an Arduino Diecimila. If you have another board, read the corresponding page in this getting started guide.

The Arduino Diecimila is a simple board that contains everything you need to start working with electronics and microcontroller programming. This diagram illustrates the major components of the board.

You also need a standard USB cable (A plug to B plug): the kind you would connect to a USB printer, for example.

2 | Download the Arduino environment

To program the Arduino board you need the Arduino environment.

Download: the latest version from the download page.

When the download finishes, unzip the downloaded file. Make sure to preserve the folder structure. Double-click the folder to open it. There should be a few files and sub-folders inside.

3 | Locate the USB drivers

If you are using a USB Arduino, you will need to install the drivers for the FTDI chip on the board. These can be found in the drivers/FTDI USB Drivers directory of the Arduino distribution. In the next step ("Connect the board"), you will point Window's Add New Hardware wizard to these drivers.

The latest version of the drivers can be found on the FTDI website.

4 | Connect the board

On the Diecimila, the power source is selected by the jumper between the USB and power plugs. To power the board from the USB port (good for controlling low power devices like LEDs), place the jumper on the two pins closest to the USB plug. To power the board from an external power supply (6-12V), place the jumper on the two pins closest to the power plug. On the Duemilanove, the power source is selected automatically (there is no power selection jumper). In any case, connect the board to a USB port on your computer.

The power LED should go on.

The Add New Hardware wizard will open. Tell it not to connect to Windows update and click next.

Then select "Install from a list or specified location (Advanced)" and click next.

Make sure that "Search for the best driver in these locations is checked"; uncheck "Search removable media"; check "Include this location in the search" and browse to the location you unzipped the USB drivers to in the previous step. Click next.

The wizard will search for the driver and then tell you that a "USB Serial Converter" was found. Click finish.

The new hardware wizard will appear again. Go through the same steps. This time, a "USB Serial Port" will be found.

5 | Connect an LED (if you're using an older board)

The first sketch you will upload to the Arduino board blinks an LED. The Arduino Diecimila (and the original Arduino NG) has a built-in resistor and LED on pin 13. On Arduino NG Rev. C and pre-NG Arduino boards, however, pin 13 does not have a built-in LED. On these boards, you'll need to connect the positive (longer) leg of an LED to pin 13 and the negative (shorter) leg to ground (marked "GND"). The LED will typically be flat on the side with the negative leg. Normally, you also need to use a resistor with the LED, but these boards have a resistor built-in on pin 13.

6 | Run the Arduino environment

Open the Arduino folder and double-click the Arduino application.

7 | Upload a program

Open the LED blink example sketch: File > Sketchbook > Examples > Digital > Blink.

Here's what the code for the LED blink example looks like.

Select the serial device of the Arduino board from the Tools | Serial Port menu. On Windows, this should be COM1 or COM2 for a serial Arduino board, or COM3, COM4, or COM5 for a USB board. To find out, open the Windows Device Mananger (in the Hardware tab of System control panel). Look for a "USB Serial Port" in the Ports section; that's the Arduino board.

Make sure that "Arduino Diecimila" is selected in the Tools > Board menu.

Now, simply click the "Upload" button in the environment. Wait a few seconds - you should see the RX and TX leds on the board flashing. If the upload is successful, the message "Done uploading." will appear in the status bar. (Note: If you have an Arduino Mini, NG, or other board, you'll need to physically present the reset button on the board immediately before pressing the upload button.)

8 | Look for the blinking LED

A few seconds after the upload finishes, you should see the amber (yellow) LED on the board start to blink. If it does, congratulations! You've gotten Arduino up-and-running.

If you have problems, please see the troubleshooting suggestions.

9 | Learn to use Arduino

  • Tutorials: try these example programs.
  • Reference: read the reference for the Arduino language.

The text of the Arduino getting started guide is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the guide are released into the public domain.

0最後修改紀錄: 2009/03/17(Tue) 23:28:01


尚未登入. (登入)

since 2011/06/20 18:23