您的位置:首页 > 编程语言 > Java开发

Arduino + Eclipse 开发环境搭建

2015-09-11 23:08 381 查看
1. 下载并安装 Arduino IDE:http://www.arduino.cc/en/Main/Software

2. 下载并安装 Eclipse IDE (for C/C++ Developers):http://www.eclipse.org/downloads

3. 安装插件 Arduino eclipse extensions:[Help] => [Eclips Marketplace ...] => Arduino eclipse IDE => [Install]

4. 设置开发环境 Arduino IDE path:

Windows: [Windows] => [Preferences] => [Arduino] => [Arduino IDE path] => <Arduino IDE 安装路径>
OS X: [Eclipse] => [Preferences...] => [Arduino] => [Arduino IDE path] => <Arduino IDE 安装路径>
在命令行下查看 Arduino IDE 程序包(Arduino.app) 的属性:ls -@l /Applications/Arduino.app
如果有额外的属性(例如: com.apple.quarantine)导致设置路径不成功,需要将额外的文件属性去除掉:xattr -d com.apple.quarantine /Applications/Arduino.app

5. 设置编译工具和配置文件的搜索路径:[Windows]/[Eclipse] => [Preferences] => [C/C++] => [Build] => [Build Variables] => [Add ...]

A.TOOLS.BOSSAC.PATH = ${A.RUNTIME.HARDWARE.PATH}/tools/${A.ARCHITECTURE}
A.RUNTIME.TOOLS.AVR-GCC.PATH = ${A.RUNTIME.HARDWARE.PATH}/tools/${A.ARCHITECTURE}
6. 创建Arduino项目工程:[File] => [New] => [Project...] => [Arduino] => [New Arduino sketch] => ...
7. 编写测试代码:
// Do not remove the include below
#include "Demo.h"

//The setup function is called once at startup of the sketch
void setup()
{
    Serial.begin(115200);
    Serial.println("!!! setup done ...");
}

// The loop function is called in an endless loop
void loop()
{
    static int counter = 0;
    char buffer[64] = { 0 };

    snprintf(buffer, sizeof(buffer), "!!! loop %d ...", counter++);
    Serial.println(buffer);
    delay(1000);
}



8. 编译工程,下载目标文件到开发板 。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  arduino eclipse