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 !