-
创建工程
新建工程
、
进行vs code的下载,等待一段时间
工程代码
#include <Arduino.h>
// put function declarations here:
int myFunction(int, int);
void setup() {
// put your setup code here, to run once:
int result = myFunction(2, 3);
pinMode(2,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(2,HIGH);
delay(100);
digitalWrite(2,LOW);
delay(100);
}
// put function definitions here:
int myFunction(int x, int y) {
return x + y;
}
编译工程![](https://i-blog.csdnimg.cn/direct/0ca004a5c87c46d88a5e63ef8dc324e2.png)
报错:
Tool Manager: Looking for another mirror... Tool Manager: Error: Please read https://bit.ly/package-manager-ioerror Tool Manager: Warning! Package Mirror: HTTPSConnectionPool(host='dl.registry.ns3.platformio.org', port=443): Max retries exceeded with url: /tools/8b/e9/ba6c8371b03c0069fcb645f5ace6587ae2760099a164a1b62785115a0f91/tool-mklittlefs-windows_amd64-1.203.210628.tar.gz (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000019D4D685290>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。'))
解决:
在命令行中使用安装所需要的安装包
依次安装三个包:
pio pkg install -g --tool "platformio/framework-arduinoespressif32@^3.20007.0"
pio pkg install -g --tool "tool-esptoolpy @ 1.30300.0(3.0.0)"
pio pkg install -g --tool "toolchain- riscv32-esp @8.4.0+2021r2-patch3"