> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/di-42-zhang-qian-ru-shi-ping-tai-ji-kai-fa-huan-jing/di-42.7-jie-arduino-kai-fa-huan-jing.md).

# 42.7 Arduino 开发环境

## Arduino 平台概述

Arduino 是面向电子爱好者与教育工作者的开源硬件平台。以下为在 FreeBSD 上的安装配置步骤。

[Arduino](https://www.arduino.cc/)（中文常音译为阿尔杜伊诺）是一个开源电子原型开发平台，于 2005 年由意大利伊夫雷亚交互设计学院（Interaction Design Institute Ivrea，IDII）的师生共同发起创立。该项目的初衷是服务于教学用途（具体为交互设计硕士课程），让非专业背景的人士也能开展电子项目开发。2006 年，由于资金困难，伊夫雷亚交互设计学院（2001—2006 年存续）宣告停办，但 Arduino 项目原型却得以保留并持续发展。

Arduino 项目的愿景与 FreeBSD 项目的开源理念有共通之处，[Arduino 的官方愿景](https://www.arduino.cc/en/about/)明确提出要让 Arduino 平台可供任何人使用。

> **背景知识**
>
> Arduino 这一名称源自一千多年前的一位意大利统治者，伊夫雷亚的阿尔杜因（Arduin of Ivrea），其名字含义为“勇敢的朋友”。而在这位统治者的出生地，意大利北部风景如画的伊夫雷亚镇（Ivrea），有一家酒吧“di Re Arduino”（意为“国王 Arduino 的”），Arduino 项目的联合创始人曾是这家酒吧的常客，项目名称即由此而来。

本节推荐使用 OpenJDK 8。FreeBSD Ports 中 arduino18 的 Makefile 声明 `JAVA_VERSION= 8+`（即 Java 8 及以上），但较高版本的 Java 可能存在兼容性问题，若使用 OpenJDK 25 遇到异常，请切换回 OpenJDK 8。

Arduino 1.X 与 2.X 架构比较：

| 组件         | Arduino 1.X      | Arduino 2.X               |
| ---------- | ---------------- | ------------------------- |
| IDE 前端     | Java（Processing） | Eclipse Theia（TypeScript） |
| 打包方式       | 原生 Java 应用       | Electron 桌面应用             |
| 编译后端       | arduino-builder  | arduino-cli（Go 语言）        |
| 编辑器特性      | 基础文本编辑           | IntelliSense / 自动补全       |
| 调试支持       | 无内置调试器           | 内置串口调试器                   |
| FreeBSD 支持 | 原生 Ports 支持      | 需 Linux 兼容层               |

## Arduino 1.X 安装方法

**使用 pkg 二进制包管理器安装：**

```sh
# pkg install arduino18 uarduno
```

或者使用 Ports 构建：

```sh
# cd /usr/ports/devel/arduino18 && make install clean      # Arduino IDE
# cd /usr/ports/comms/uarduno && make install clean       # Arduino Uno 内核驱动模块
```

编辑 **/boot/loader.conf** 文件，写入下行使其默认加载内核驱动：

```sh
uarduno_load="YES"
```

重启系统。

在桌面环境菜单中启动 Arduino IDE。

![Arduino IDE](/files/q5K3ThrHiSBgYJnNq23E)

设置路径后主界面如下：

![Arduino IDE 主界面](/files/3ipgPLUqatRsjyr84r9Y)

## Arduino IDE 2.X

Arduino 2.x 系列基于 Eclipse Theia 框架（而非 VS Code 分支），使用 Electron 打包为桌面应用，配合 Go 语言编写的 arduino-cli 提供后端编译服务。

需要预先部署 Linux 兼容层。

赋予可执行文件 **arduino-ide** 执行权限后可直接运行：

```sh
$ ./arduino-ide --no-sandbox
```

![Arduino IDE 2.X 主界面](/files/noBQEz8w2qh1FUrrqMnk)

## 参考文献

* Arduino 中国官方微信公众号. Arduino，你的名字究竟该怎么读？\[EB/OL]. (2016-12-09)\[2026-03-25]. <https://mp.weixin.qq.com/s/O4wfBF_WlHksmoWbMs7QeA>. 详细介绍 Arduino 名称的由来与正确发音。微信公众号运营主体为 Arduino 在中国的外企独资公司，法定代表人为创始人 Federico Musto 先生。
* 大英百科全书. Arduin of Ivrea\[EB/OL]. \[2026-03-25]. <https://www.britannica.com/biography/Arduin-of-Ivrea>. 大英百科全书关于意大利统治者阿尔杜因·德·伊夫雷亚的历史记载条目。
* Eclipse Foundation. Eclipse Theia FAQ\[EB/OL]. \[2026-04-17]. <https://theia-ide.org/docs/faq/>. 明确说明 Theia 并非 VS Code 的分支，而是独立开发的 IDE 平台。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/di-42-zhang-qian-ru-shi-ping-tai-ji-kai-fa-huan-jing/di-42.7-jie-arduino-kai-fa-huan-jing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
