Arduino IDE开发ESP32环境搭建到helloworld

我是一个初学者,记录学习过程。仅供参考。

之前我已经在VSCode之中搭建好了ESP32的开发环境,然后有时会刷到一些教程用的Arduino IDE。 我也不清楚哪种方式更好,就试试吧。

本文是我在以下这篇做完后的基础上做的,我也不清楚哪些地方会有影响。

《archlinux 搭建ESP32开发环境 从0到Hello world》

https://blog.csdn.net/lxyoucan/article/details/166984393

中文可以近似读作:阿尔杜伊诺。

一共四个音节:Ar-du-i-no,重音在第三个音节(i)上。

这个名字来自意大利语,日常交流中按这个发音读就可以了。

环境信息

本文是在archlinux下测试的。

OS: Arch Linux x86_64

Kernel: Linux 7.2.9-zen1-1-zen

我看了一下Arduino 这个软件是可以跨平台的,理论上应该差距不大。

下载与安装

下载地址:

https://www.arduino.cc/en/software/

我这里下载下来是

arduino-ide_2.3.10_Linux_64bit.AppImage

bash 复制代码
chmod +x arduino-ide_2.3.10_Linux_64bit.AppImage
./arduino-ide_2.3.10_Linux_64bit.AppImage

就可以直接运行了。

第1次打开会显示一直在下载什么依赖。一会儿就结束了。

如果想有个图标,可以这样做:

创建~/.local/share/applications/arduino-ide.desktop

内容如下:

bash 复制代码
[Desktop Entry]
Version=1.0
Type=Application
Name=Arduino IDE
Comment=Arduino Integrated Development Environment
Exec=/home/itkey/.soft/arduino-ide_2.3.10_Linux_64bit.AppImage --no-sandbox %U
TryExec=/home/itkey/.soft/arduino-ide_2.3.10_Linux_64bit.AppImage
Icon=arduino-ide
Terminal=false
Categories=Development;Electronics;IDE;
Keywords=Arduino;IDE;
StartupWMClass=Arduino IDE
X-AppImage-Version=2.3.10

运行报错

./arduino-ide_2.3.10_Linux_64bit.AppImage

dlopen(): error loading libfuse.so.2

AppImages require FUSE to run.

You might still be able to extract the contents of this AppImage

if you run it with the --appimage-extract option.

See https://github.com/AppImage/AppImageKit/wiki/FUSE

for more information

解决办法:

bash 复制代码
sudo pacman -S fuse2

然后就可以正常打开软件了,首先打开会提示在下载一些内容:

bash 复制代码
Downloading packages
arduino:arduinoOTA@1.3.0
arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7
arduino:avrdude@8.0.0-arduino1
arduino:avr@1.8.8
Installing arduino:arduinoOTA@1.3.0
arduino:arduinoOTA@1.3.0 installed
Installing arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7
arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7 installed
Installing arduino:avrdude@8.0.0-arduino1
arduino:avrdude@8.0.0-arduino1 installed
Installing platform arduino:avr@1.8.8
Platform arduino:avr@1.8.8 installed
Downloading Mouse@1.0.1
......

设置语言为中文

File==>Preferences...

选择开发板

我这里搜索的是esp32 选择的是ESP32-C3 Dev Board

这里会有一个提示,安装开发板内核 esp32v 3.3.12 内核。

这一步就开始自动下载安装内核了,感觉就像安装一个插件一样的。

这一步下载挺久的,总下载量约2.3GB。如果下载过慢。

可以尝试

  1. proxy加速。
  2. https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html

Users in China might have troubles with connection and download speeds

using GitHub. Please use our Jihulab mirror as the repository source:

https://jihulab.com/esp-mirror/espressif/arduino-esp32.git

使用国内的源。理论上更推荐,但是我没有试,可以自行尝试。

我电脑放一边下载了挺久的,预计20分钟到30分钟吧。到这个界面应该已经下载完成了。

hello world

新建一个项目

比如:我这里默认打开了sketch_oct14.ino

"工具"中设置:

选项 值
开发板 ESP32C3 Dev Module
USB CDC On Boot Enabled
Flash Size 4MB,与项目分区表对应
Partition Scheme No OTA (1MB APP/3MB SPIFFS)
Upload Speed 115200
Port /dev/ttyACM0

为什么要这么设置,是AI帮我分析告诉我的,我先按这个来。

我估计是根据板子配置来的吧。

我写了个hello world

bash 复制代码
void setup() {
  // 初始化串口,波特率为 115200
  Serial.begin(115200);
}

void loop() {
  // 输出 Hello World!
  Serial.println("Hello World!");

  // 延迟 1 秒
  delay(1000);
}

按ctrl + s保存项目,自己选择一个文件夹就可以了。

点击 ✓ 验证,然后点击 → 上传。

✓ 应该就是编译的意思

→ 上传应该就是烧写的意思吧

运行效果

将代码编译并上传到开发板后:

  1. 打开 Arduino IDE。
  2. 点击右上角的 串口监视器(Serial Monitor)。
  3. 将波特率设置为 115200。
  4. 就可以看到每秒输出一次:

示例

这里有一些内置的示例,感觉不错,使用起来很方便 。

海量示例,对我这样的初学者很有帮助。

总结

对比我之前用vscode搭建的方式

《archlinux 搭建ESP32开发环境 从0到Hello world》

https://blog.csdn.net/lxyoucan/article/details/166984393

我感觉用Arduino IDE 好像更简单,方便。

相关推荐
别问!问就是全会6 小时前
Jupyter Notebook 安装包下载|单元格分块运行,图表直接内嵌
ide·python·其他·jupyter
1024奇点1 天前
【仓颉语言入门 · 第二篇 第 22 课】
开发语言·ide·开源
techpupil2 天前
IDEA基础配置及开发基础插件
java·ide·intellij-idea
赵庆明老师2 天前
Android Studio Google源代理配置
android·ide·android studio
天空'之城2 天前
004基于语音识别的智能家居本地控制系统
毕业设计·esp32·智能家居·语音识别·离线控制
2501_916008892 天前
iOS App 图标、启动屏和多语言搭配 方法,上架前使用KXBuild一次做好 App 图标
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
2501_915909063 天前
Windows 打开 Xcode 工程,编译调试 Xcode 项目并和 Mac 同事协作
ide·windows·vscode·macos·ios·个人开发·xcode
golang学习记3 天前
比VS Code轻10倍,JetBrains开源全新AI IDE
ide·人工智能·jetbrains·thinkrail
我要见SA姐14 天前
Chrome 内存泄漏诊断指南:从现象定位到根因排查
ide·vscode·python·自动化·编辑器
00后程序员张4 天前
Windows 开发 iOS App 入门,用 SwiftUI 写第一个 iOS App 装到 iPhone
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程