Mac中配置eclipse的Arduino开发环境

需要下载的工具

Arduino IDE for Mac OS X(当前使用版本1.0.5)

FTDIUSBSerialDriver Mac OSX版本(当前使用版本2.2.18)

Eclipse IDE for Java(当前使用的版本4.3 Kepler)

首先,安装Arduino IDE并确保可以连接到Arduino板子,单纯安装ADE可能在运行是会不成功,这应该是没有安装FTDI驱动所造成,再安装FTDI驱动后就没有问题了。

再来,安装Eclipse,由于平时一直开发Java,所以我的Mac上已经装有Eclipse for Java了;如果平时没有开发Java的需要可以直接下载 Eclipse for C/C++ Developers 的版本,这样可以忽略下面的步骤。

为Eclipse安装C/C++插件,看这里:http://eclipse.org/cdt/

如果上面的链接无法打开,看看下面的简单步骤

1. 打开eclipse;

2. 菜单 Help -> Install New Softwave...;

3. Work with填写:http://download.eclipse.org/tools/cdt/releases/kepler;

4. 等待下面列表显示内容;

5. “Select All”选中列表中全部内容;

6. “Next”;

7. 之后就是见“Next”点“Next”,见“Yes”点“Yes”;

8. 最后restart eclipse,插件安装完成。

开始安装Arduino插件,与上面的步骤基本相同

1. 打开eclipse;

2. 菜单 Help -> Install New Softwave...;

3. Work with填写:http://www.baeyens.it/eclipse/update;

4. 等待下面列表显示内容;

5. 选中列表中的“Arduino eclipse extensions 1.2.4”;

6. “Next”;

7. 之后就是见“Next”点“Next”,见“Yes”点“Yes”;

8. 最后restart eclipse,插件安装完成。

Arduino插件配置

1. 菜单Eclipse -> Preferences,在设置中选择Arduino -> Arduino;

2. 填写“Arduino IDE paht”,内容来自Arduino IDE应用,右键菜单中选择“显示包内容”,最终获得如下信息:“/Applications/Arduino.app/Contents/Resources/Java”;

3. 填写“Private Library path”,这里我填写的就是Arduino IDE的libraries目录:“/Users/aclyyx/Documents/Arduino/libraries”;

4. 勾上“Use Arduino IDE tools in eclipse”;

5. 在设置中选择Arduino -> AVRDude;

6. 勾上“Use custom configuration file for AVRDude”;

7. 填写“AVRDude config file”,“/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf”;

8. 在设置中选择Arduino -> Paths;

9. 编辑“AVR-GCC”、“GNU make”、“AVRDude”的Custom value为“/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin”;

10.编辑“AVR Header Files”的Custom value为“/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/include”;

11.在设置中选择General -> Workspace并选中“Save automatically before build”;

12.再到C/C++ -> Indexer,选中“Index unused headers”和“Index source and header files opened in editor”。

至此Arduino的eclipse插件配置基本完成。

为什么是基本完成呢?因为在实际使用后又遇到了问题。

首先是向Arduino开发版传送程序时报错,“Serial port /dev/tty.usbserial-XXX already in use. Try quiting any programs that may be using it”,无论如何检查都没有发现问题,而且在Arduino IDE中是正常的。

后来搜索到是权限的问题导致,需要在“终端”使用如下命令:

sudo mkdir /var/lock
sudo chmod a+rw /var/lock

串行端口将不再是繁忙的,当然,除非别的东西真的使用它!(感谢Google翻译)

一个问题刚刚解决又来一个,在使用“Serial.begin(9600);”是报错,说是找不到。

继续Google,找到了解决方法,如下:

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

Do next four in this sequence
Right click the project->index->Search for unresolved includes.
Right click the project->index->Freshen all Files.
Right click the project->index->Update with modified files.
Right click the project->index->Rebuild.

参考资料:

http://aguegu.net/?p=567

http://robots.dacloughb.com/project-1/setting-up-the-arduino-eclipse-environment-on-mac-os-x-lion/

http://www.ftdichip.com/Support/Documents/AppNotes/AN_134_FTDI_Drivers_Installation_Guide_for_MAC_OSX.pdf

http://stackoverflow.com/questions/12866572/rxtx-on-mac-serial-port-already-in-use

http://stackoverflow.com/questions/10973787/arduino-eclipse-can-not-resolve-serial

猜你喜欢

转载自aclyyx.iteye.com/blog/2018468
今日推荐