How to add a console to your Serial port in Eclipse

I didn't find any way to make a console work efficiently with my fresh "Eclipse for Arduino" installation, so I decided to find a work around to launch it. First thing is to get PuTTY. Then, put this little bash file I made wherever you want (the file extension must be .bat).

[source lang="bash"]

@echo off
REM Check for user inputs
if "%1"=="" GOTO BadArgs
if "%2"=="" GOTO BadArgs
if not exist putty.exe GOTO BadPuttyInstall

REM Local variables.

REM Modify registry keys for modifying the putty settings.
@REG ADD HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\%PUTTY_SETTINGS% /V SerialLine /T REG_SZ /D %COM_PORT% /F > NUL
@REG ADD HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\%PUTTY_SETTINGS% /V Protocol /T REG_SZ /D serial /F  > NUL

REM Load the setting with putty.
echo Launching Serial console (PORT %COM_PORT% ; BAUDRATE %BAUD_RATE%)
putty -load %PUTTY_SETTINGS%
goto EndProg

REM Error management.
echo Problem with number of arguments. For example : COM3 9600 ; COM2 115200.
goto EndProg

echo Could not find Putty. Make sure that the working directory contains it.



(Be aware that this script makes modifications in your registry, so make sure you know what you do).

Next we'll integrate it into eclipse.Go to Run>External Tools>External Tools Configuration. Create a new configuration. In the main tab, in location, indicate the path to your bash file. As a working directory, select your PuTTYdirectory. As arguments, put first the name of the port you want to connect to, and then the baudrate (for example you'll have COM2 9600 ; or COM12 115200). In the "Build" tab, uncheck "Build before launch".

You can launch this by clicking on the icon next to the "Run Project" (it's a little green arrow with a brown toolbox).

If you want to change the console color/aspect (typically, I like to have it in front of all other windows), just run PuTTY, load the "ArduinoSettings" settings, modify it as you want, and save it.

Hope it will be usefull !

How to use Arduino with Eclipse

Complete explanations :

Why changing the IDE

If you're familiar with the Arduino IDE, you will agree that it's not very convenient to use. For exemple, you won't be able to do multiline tabulation, autocompletion and advanced programming tips in general. Well here's the good news : you can use a very powerful IDE, Eclipse (well known by Java developers) to make your Arduino developpements. This article is meant to help you doing this.


First, download the Eclipse IDE. Be sure to choose the C/C++ version, not the Java's one.Then, you need to download the Arduino IDE. It will get you access to the compiler and the core libraries.

Configure Eclipse

The first thing to do is to launch Eclipse IDE.If Eclipse tells you that JRE is missing, you'll have to install it manually. If you are running Windows 7 64bits, download the specific 64bits version of this JRE, otherwise it won't work.

After Eclipse has started, you'll be prompted for a wordspace folder, select wherever you want to save your future projects. Personnally, I've a root folder "EclipseForArduino" where are located Eclipse IDE, Arduino IDE and my workspace.

Ok, now you have to install the Eclipse extension for using AVR compilers. Go to help>Install new software. In the "Work with: " field, type site/, and then select the Arduino eclipse extensions software. Install it, then restart Eclipse. You'll have a new menu item "AVR". Lets configure it with Window>preferences, Arduino tab , Arduino>Arduino Settings for this workspace. Put your arduino IDE (for me : D:\EclipseForArduino\arduino-1.0.1. Check "Use Arduino IDE tools in eclipse".

Click Apply, and go to the "Paths" tab to check if everything's ok (except for the last one, which is not important).

In AVRDude, the "Use custom configuration file for AVRDude" checkbox must be checked, and filled out with the avrdude.conf file from Arduino IDE.

OK, now you should be able to create a new project : File>New..>Other.. ; select Arduino>New Arduino Sketch. You'll have to select your serial port and board revision.

To avoid problems while using Serial ibraries (typically, Eclipse says there are bugs when you use Serial, but you still can compile it) :

windows->preferences->C/C++->indexer->index unused headers.
windows->preferences->C/C++->indexer->index source and header files opened in the editor.
windows->preferences->C/C++->indexer->Files to index upfront . Add arduino.h and or WProgram.h.

To import a library in your project, simply right click on it, then select "Import...", and "Import a arduino library in the current project". That's almost it. If you have some problems, first review the official plugin support site (I gave a link to it at the beginning of this article).

Export/Import your Arduino project

How to import an existing project, lets say, to an other computer ? First there are 2 prerequisites to make it possible :

  • The needed libraries must have been placed in the folder specified under plugin preferences
  • In additiont o the sources, .project and .cproject files must be present in the sources folder. Without those files, you'll have to manually import the needed libraries.

The steps of import procedure are :

  1. In Eclipse, choose the existing project import.
  2. Check that the plugin is well installed. The included libraries must be in the good folders (check both core and personal libraries)
  3. If the board you want to use is not il your existing projects, create a new Arduino project to generate it. You can next delete this newly created project as the board project wil stay.
  4. Under project preferences, Arduino tab, select the newly created board.
  5. Import is now over. One can continue to work on the project.