Introduction to Arduino IDE

From robotics

Arduino

Arduino is a both an open source software library and an open-source breakout board for the popular AVR micro-controllers. The Arduino IDE (Integrated Development Environment) is the program used to write code, and comes in the form of a downloadable file on the Arduino website. The Arduino board is the physical board that stores and performs the code uploaded to it. Both the software package and the board are referred to as "Arduino."

The Arduino Software

To begin, download the Arduino IDE from the Arduino website. Make sure to select the right version for your Operating System (OS). For a full getting started guide for each OS, please refer to the Arduino guide. Once the arduino.zip file has been downloaded, extract the file to a folder somewhere on your computer. There is no install - simply open the folder and double click the .exe.

Note: If you are running Windows 8, you will likely see "The driver is not digitally signed" when installing the driver. To install it, you must first disable driver signature enforcement.

Note: If you plan on using Eclipse, the path cannot have any special characters. For example, a path that includes "Program Files(x86)" is invalid.

Connecting the Arduino

Connecting an Arduino board to your PC is quite simple. On Windows:

1. Plug in the USB cable - one end to the PC, and one end to the Arduino board.

2. When prompted, select "Browse my computer for driver" and then select the folder to which you extracted your original Arduino IDE download.

3. You may receive an error that the board is not a Microsoft certified device - select “Install anyway.”

4. Your board should now be ready for programming.


For more help see the Getting Started with Arduino webpage.

When programming your Arduino board it is important to know what COM port the Arduino is using on your PC. On Windows, navigate to Start->Devices and Printers, and look for the Arduino. The COM port will be displayed underneath.

Alternatively, the message telling you that the Arduino has been connected successfully in the lower-left hand corner of your screen usually specifies the COM port is it using.

Preparing the Board

Before loading any code to your Arduino board, you must first open the IDE. Double click the Arduino .exe file that you downloaded earlier. A blank program, or "sketch," should open.

The Blink example is the easiest way to test any Arduino board. Within the Arduino window, it can be found under File->Examples->Basics->Blink.

Before the code can be uploaded to your board, two important steps are required.

1. Select your Arduino from the list under Tools->Board. The standard board used in RBE 1001, 2001, and 2002 is the Arduino Mega 2560, so select the "Arduino Mega 2560 or Mega ADK" option in the dropdown.

2. Select the communication port, or COM port, by going to Tools->Serial Port.

If you noted the COM port your Arduino board is using, it should be listed in the dropdown menu. If not, your board has not finished installing or needs to be reconnected.

Loading Code

The upper left of the Arduino window has two buttons: A checkmark to Verify your code, and a right-facing arrow to Upload it. Press the right arrow button to compile and upload the Blink example to your Arduino board.

The black bar at the bottom of the Arduino window is reserved for messages indicating the success or failure of code uploading. A "Completed Successfully" message should appear once the code is done uploading to your board. If an error message appears instead, check that you selected the correct board and COM port in the Tools menu, and check your physical connections.

If uploaded successfully, the LED on your board should blink on/off once every second. Most Arduino boards have an LED prewired to pin 13.

It is very important that you do not use pins 0 or 1 while loading code. It is recommended that you do not use those pins ever.

Arduino code is loaded over a serial port to the controller. Older models use an FTDI chip which deals with all the USB specifics. Newer models have either a small AVR that mimics the FTDI chip or a built-in USB-to-serial port on the AVR micro-controller itself.