码迷,mamicode.com
首页 > 系统相关 > 详细

(转)使用eclipse Arduino IDE开发 AVR程序

时间:2015-10-13 20:55:17      阅读:428      评论:0      收藏:0      [点我收藏+]

标签:

 

小白写程序都是用eclipse的,所以学习Arduino时自然就想用eclipse,因为俺懒,这样省事。网上找了些帖子看看,感觉开发环境都比较麻烦,这样不符合俺这种懒人的风格,所以我弄了个简单点的。

第一步:下载各种东西
1、JDK,这个去oracle官网下就好了(其实百度下载更快)http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-windows-x64.exe。
2、eclipseArduinoIDE,http://eclipse.baeyens.it/download.php
3、arduino-1.5.6-r2http://www.arduino.cc/en/Main/OldSoftwareReleases,eclipseArduinoIDE要这个版本,现在最新是1.58了,我没试好不好用。     

第二步:安装配置
1、装完eclipseArduinoIDE,打开菜单Window>References设置Arduino项,Arduino IDE path指向arduino-1.5.6-r2安装目录,Arduino Librarie path指向arduino-1.5.6-r2的libraries 目录 ,Arduino hardware path指向arduino-1.5.6-r2的hardware 目录 。
<ignore_js_op>技术分享 
做完这个设置保存是系统会提醒你去http://eclipse.baeyens.it/installAdvice.shtml看配置文档。

2、实际上配置文档里最主要的是要运行下下面的脚本。
@ECHO OFF

:: Recommended usage and things that can go wrong ...
::
:: This batch file does not tollerate spaces or any other strange characters in the path names.
::
:: Recommended usage scenario would be to copy the [arduino_IDE_install_directory]/hardware/arduino directory
::   to a temporary directory that you created at the root of a drive ... something like C:\_temp will do but feel
::   free to call it what ever you want as long as there are no spaces or special characters in it. This ensures
::   there will not be any spaces in any of the path names and also keeps the original files until you are sure
::   the 1200+ files that will be changed are ‘right‘ before you overwrite the originals.
::
:: Now that you have C:\_temp\arduino, put this file in the directory. Make sure the extension is .bat as it may have
::   been changed to something else to allow it to pass thru spam and virus scanning software.
::
:: Run the batch file. It will take a while as it is modifying 1200+ files. If you want to see exactly what it is
::   doing comment out the ‘@ECHO OFF‘ ... ‘:: @ECHO OFF‘ ... before you execute the batch file.
::
:: After running the batch file and ensuring you are satisfied with the results replace the contents of the
::   [arduino_IDE_install_directory]/hardware/arduino directory with the contents of the C:\_temp\arduino directory.
  ::
:: This batch file does not provide any safeguards related to you doing the wrong thing ... i.e. running it a second time
::   on previously patched files, etc. ... so Stop, Pause, Think is your best course of action.
::

SET temporaryFile=%CD%\temporary_%RANDOM%.txt
SET appendFile=%CD%\textToAppend_%RANDOM%.txt
SET prependFile=%CD%\textToPrepend_%RANDOM%.txt

ECHO #endif>%appendFile%

SET architecture=AVR
ECHO #ifdef ARDUINO_ARCH_%architecture%>%prependFile%
ECHO #endif /* ARDUINO_ARCH_%architecture% */>%appendFile%

PUSHD %architecture%
FOR /F "usebackq delims=*" %%i IN (`dir /b /s *.cpp /s *.h /s *.c`) DO TYPE %prependFile%>%temporaryFile% & TYPE %%i>>%temporaryFile% & TYPE %appendFile%>>%temporaryFile% & MOVE /Y %temporaryFile% %%i
POPD

SET architecture=SAM
ECHO #ifdef ARDUINO_ARCH_%architecture%>%prependFile%
ECHO #endif /* ARDUINO_ARCH_%architecture% */>%appendFile%

PUSHD %architecture%
FOR /F "usebackq delims=*" %%i IN (`dir /b /s *.cpp /s *.h /s *.c`) DO TYPE %prependFile%>%temporaryFile% & TYPE %%i>>%temporaryFile% & TYPE %appendFile%>>%temporaryFile% & MOVE /Y %temporaryFile% %%i
POPD

DEL /F /Q %appendFile%
DEL /F /Q %prependFile%

把上面的代码复制下来,存成.bat文件,然后放到\arduino-1.5.6-r2\libraries目录下运行一下就ok了。

3、在菜单Window>References的C/C++项下面的File Types里面新建两项:*.ino 和*.pde,不建这两项的话没法编译。

第三步:新建项目
File-->new-->new Arduino sketch:
Boards.txt file选项里有avr和sam的两种,我用的nano,所以选avr的。
<ignore_js_op>技术分享 

2014-10-12 17:54 上传
下载附件 (73.72 KB)
 


其他的选项根据自己的情况选就行。然后“下一步”,Finish完事。

接下来就想干嘛干嘛吧~很简单是不~~~

(转)使用eclipse Arduino IDE开发 AVR程序

标签:

原文地址:http://www.cnblogs.com/larry-home/p/4875752.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!