Arduino Programming using Eclipse

Introduction

This article describes how to set up Eclipse Arduino IDE (Sloeber) to be able to develop programs on a Windows computer for Arduino Mega. It should work also for other AVR-based Arduinos.

Background

I probably don’t need to tell you why use Eclipse instead of the Arduino IDE. If you plan to create more complex project with your Arduino or even see yourself as an embedded software developer someday, you will soon outgrow the Arduino IDE. And then there are two main options: Eclipse or Atmel Studio. If you read this, you probably decided for Eclipse, which is choice I like myself too.

Install the tools

We will need the following tools:

Here are the installation procedures:

Eclipse Arduino IDE
Download the software from https://github.com/Sloeber/arduino-eclipse-plugin/releases/  . The latest stable version (June 2017) is V4.1. Download the zip file and extract it to any folder on your computer, for example, to C:\Sloeber.

To start Eclipse Arduino IDE, go to the extract folder (C:\Sloeber) and run sloeber-ide.exe.
You may want to create link on your desktop for quick access.

When Eclipse starts, you need to select location for your workspace. This is a folder on your computer where all your projects will be located. Later you can use several workspaces and change the default location, but for now I recommend just accepting the default offered by Eclipse and moving on.

 At this point Eclipse will download all the necessary configurations into the C:\Sloeber\ arduinoPlugin folder. Relax and wait for it to complete

Create your first Arduino program

This section describes how to create project with Arduino MCU Framework (the software library), so that you can use the Arduino functions in your program.

  1. Go to File > New > New Arduino sketch.
  2. Enter name of your project, for example, Blink and click next.
  3. In the next step select the platform folder, the board and the processor. Leave the Upload protocol as Default and click Next
  4. In the next step select the sketch template and click finish

We now have an empty project and will add links to the Arduino files into the project.

Paste the following code into the Blink.ino file:

Build your project.

The project should built without errors, there may be some warnings in functions but these have no effect on our program. The build may take little longer first time because all the Arduino core functions are built, but later, the compiler is smart enough to build only changed files, so it takes only few seconds to build the program.

Now upload your project to your Arduino board.

First, connect the Arduino board to your computer. Give the computer enough time recognize the board.

Right click on the project and select properties. In the property window click Arduino and set the port and click Ok

Blink example

Finally go to Arduino menu and select Upload Sketch.

You should now see that the LED on your Arduino is blinking. This means our program is running.