Arduino + Eclipse 开发环境搭建

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. 编译工程,下载目标文件到开发板 。。。




  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值