Guide Contents | Introduction | How To: Windows, Mac OS X, Linux; Arduino Nano, Arduino Mini, Arduino BT, LilyPad Arduino, Arduino Pro, Arduino Pro Mini; Xbee shield | Troubleshooting | Environment
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:
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.
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.
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 directory of the Arduino distribution.
If you have an older Mac like a Powerbook, iBook, G4 or G5, you should use the the PPC drivers: FTDIUSBSerialDriver_v2_1_9.dmg
. If you have a newer Mac like an MacBook, MacBook Pro, or Mac Pro, you need the Intel drivers: FTDIUSBSerialDriver_v2_2_9_Intel.dmg
. Double-click to mount the disk image and run the included FTDIUSBSerialDriver.pkg
.
(The latest version of the drivers can be found on the FTDI website.)
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. Either way, connect the board to a USB port on your computer.
The power LED should go on.
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.
Open the Arduino folder and double-click the Arduino application.
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 the Mac, this should be something with /dev/tty.usbserial
in it.
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.)
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.
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.