Wednesday, 17 February 2016

Programming the Arduino in Eclipse

This is a note on installing the Eclipse Arduino Plugin, specifically on Windows (32-bit), with pointers to archived materiel.

There are three versions of the plugin; I had trouble installing the (beta) Version 3, so this note is about Version 2.

There's a lot of information about installing the software here; I've added a little more detail, hoping it'll prove helpful.

Java

The plugin requires Java (which the Arduino IDE also uses, so you may well have it already). You should be able to find this by searching for "download java", which should find Oracle's download site. Install it.

Plugin version 2

I call it "plugin", but in fact it's supplied in two versions: plugin is intended for installation in an existing Eclipse setup, and product is an Eclipse setup with the plugin already installed.

Best to go for the product version.

The front-page version of the Windows product is available here, in 32- and 64-bit versions.

Unfortunately, the software is only provided as a .tar.gz archive; you could use 7zip, but as a service to the community the 32-bit version is available as a .zip archive here.

Arduino

Because of a problem with the make utility, it's best to stick with Arduino releases no later than 1.5.5 (here).

Install the Arduino package at a location without spaces in the name (for example, C:\Arduino, not the default C:\Program Files\Arduino). This is because of the Unix heritage of the Eclipse software, which doesn't recognise spaces in filenames without help.

Plugin

Unpack the eclipseArduino package, again at a location without spaces in the name (for example, C:\eclipseArduino).

Start up Eclipse by double-clicking on C:\eclipseArduino\eclipseArduino (you may like to set up a shortcut). The first time, you'll be asked where you want to put your workspace; the default is probaby OK.

Setup

See the Configure tab here.

The most important things are

  • Telling Eclipse where to find the Arduino IDE (probably C:\Arduino). This is in Windows / Preferences; in the Arduino tab, enter the location in Arduino IDE path.

    If you have your own libraries, they're probably best installed under your workspace.

    You may get a warning ide not supported. I ignored it, and the software worked for me!

  • Telling Eclipse that Arduino source files are to be treated as C++ source; go to the C/C++ / File Types tab and use the New button to add *.ino and *.pde as C++ source files.

My first program

Go to Arduino / New Sketch. Provide a name (First?) and select Next.

On the next page, you say what board you want the sketch to run on and what port to use. Boards.txt says what sorts of boards are supported (basically, avr is for AVR-based boards like the Uno, whereas sam is for Cortex boards; at present, there's only one Cortex board supported, and the distinction is whether you want to connect via the "programming" port or the "native" port).

The port to use (from your computer's side) will probably be COM3.

Select Next.

On the next page, you can load a sample sketch. First change the select code pulldown to Sample sketch; now you can choose a sample. For the simple Blink program, open 01. Basics and click the checkbox for Blink.

Select Finish. You may have to wait a little while while Eclipse thinks about your new sketch (a.k.a. project).

For reasons, the sample program (Blink.ino, which is that from the Arduino) will need a bit of editing to work: at the beginning, insert

#include <Arduino.h>

No comments:

Post a Comment