Language: EN


Programming Arduino with Eclipse (1 of 2)

In the Arduino IDE installation introduction to Arduino post, we commented that it is possible to use other programming environments to carry out our Arduino projects. This allows us to bypass many limitations imposed by the standard IDE, and use the full power of C++ in our projects.

In this post, we are going to learn how to set up and program Arduino with Eclipse, one of the most popular programming environments of the moment. Eclipse is Open Source, and is available for free for Linux and Windows. The development of this tutorial will be done in Linux Ubuntu / Linux Mint, but its configuration in other operating systems is very similar.

The difficulty level of this tutorial is somewhat more advanced than the rest of the Arduino posts we have done so far but, with a little skill and following the steps in order, you will be able to configure the IDE correctly easily.

Install Eclipse

First, we are going to install the Eclipse IDE. To do this, open a terminal console and type

sudo apt-get install eclipse

Or we can directly download the program from the website, and make sure we have the latest available version.

Install avrdude

Now we are going to install AVRDUDE. The Atmega processors mounted on the Arduino boards have AVR architecture. This application will allow us to compile our C++ programs and load them onto the base board directly from Eclipse.

To do this, type the following in the terminal

sudo apt-get install gcc-avr binutils-avr gdb-avr avr-libc avrdude  make

Install the AVR-EClipse plugin

Next, we will install the “avr-eclipse” plugin, which allows us to use the functionalities of AVRDUDE from Eclipse.

To do this, open Eclipse and go to the menu (Help > Install New Software…). In the window that appears, on the “Work with:” line, type the address ””, and click “Add” to add the repository. eclipse-arduino-01 Select all available plugins and finish the installation, leaving the rest of the options by default.

New C++ project

Now that we have Eclipse and AVRDUDE installed and connected through the AVR plugin, we are going to create our first project and verify that everything works correctly.

Select “New Project” and in the wizard that appears, choose “C++ Project”. eclipse-arduino-02 On the next screen, select “AVR Cross Target Application Project” as the project type and choose a name for our project. eclipse-arduino-03 In the configuration window, select “Release”. eclipse-arduino-04 Leave the rest of the configurations as they are.

Add a new code file by right-clicking on the project and choosing “Add source file”. Define the name of this first file as “main.cpp”, and finish by clicking accept. eclipse-arduino-05 Right-click on the project in the solution explorer and select project properties. Leave only “Generate HEX file only for Flash memory” selected. eclipse-arduino-06 Now in the “Project” menu, uncheck “build automatically”, so that the program only compiles when we manually indicate it. eclipse-arduino-07 Finally, go to “Windows/Prerences” and select the option “Save automatically before build”, so that the source files are automatically saved before compiling. eclipse-arduino-08

Testing Arduino programming with Eclipse

Let’s check that we have everything configured correctly. To do this, copy this into the body of main.cpp

#include <avr/io.h>
#include <util/delay.h>
int main(void) {
  DDRB = (1<<PB5); //Pin B5 Output
  for(;;){ // while(1)
    PORTB |= (1<<PB5); //Set pin high
    PORTB &= ~(1<<PB5); //Set pin low
  return 0;

Click on the arrow next to the “Build All” button and from the dropdown, choose “Release”. Finally, click the “Build All” button, which has a hammer symbol. eclipse-arduino-09 If there are no errors… congratulations! Everything is set up and working correctly, you can now program Arduino with Eclipse and use the full power of C++ in your programs. But wait… What is all that code? That doesn’t look anything like Arduino!

Those of you who have programmed processors will recognize “that code”. What we see is the true programming of Atmel. The so-called “Wiring” is actually a series of libraries that hide and simplify the process. However, it is sometimes advantageous and more efficient to program directly at a low level.

Very interesting, but… How do we recover our Arduino libraries? In the next post, we will see how to configure our project, so that we can program Arduino with Eclipse in the same clean and understandable language to which we are accustomed in the standard IDE.

Download the code

All the code from this post is available for download on Github. github-full