博主头像
ThincHEr-L

保姆级搭建Platformio开发环境(Arduino框架)

一、开始前的准备工作

1. 安装Python

前往Python官网下载最新版本的Python,我目前使用的版本是3.13.0

安装时记得勾选上Add python.exe to PATH这样就很方便的把python添加进环境变量了。
一路默认安装即可,Python给他安在C盘就好免得出什么幺蛾子。
安装完成后Win+R打开运行,输入cmd,键入

python --version

查看是否出现正确的版本。

如果没有显示,那就是安装时没勾选Add python.exe to PATH,如果勾选了重启试试。

2. 利用python构建环境

 1) 安装python虚拟环境库

还是之前的cmd命令提示符窗口键入

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenv

pip是python的开发包管理工具,它已经在安装python时自动安装了,我们可以用它来下载各种库。-i https://pypi.tuna.tsinghua.edu.cn/simple命令是通过清华镜像站下载资源(也可以不加使用默认源下载,目的是提高下载速度)

 2)用虚拟环境创建文件夹

继续键入

virtualenv C:\Users\get\.platformio\penv

get是我的用户名,换成你自己的。

这样就是成功了
这样就是成功了

 3)激活虚拟环境

继续键入

virtualenv C:\Users\get\.platformio\penv\Scripts\active

get是我的用户名,换成你自己的。

 4)在虚拟环境安装platformio

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple platformio

 5)将如下路径加入系统环境变量

C:\Users\get\.platformio\penv\Scripts

get是我的用户名,换成你自己的。
复制上面的路径
在开始菜单搜索

点击打开,然后点开环境变量

按步骤操作
按步骤操作

一路确认就OK了

二、正式开始

1. 安装VScode

VScode官网下载Vscode

下载
下载

安装的时候可以安装在其他盘,最好不要用中文路径

记得全勾上,以后可以右键打开Code会非常方便。

2. 打开VScode,安装拓展

点击拓展按钮

首先当然是搜索中文,安装简体中文语言包

安装第一个
然后右下角重启就生效了

接下来安装

安装完事后点开左边多出来的小蚂蚁头

然后点击Open

3.新建项目

新建项目工程

填写项目名称,单片机型号,框架和项目路径。然后点击Finish

然后就是耐心等待了,第一次创建工程需要下载安装工具链,平台等,所以会有点慢,以后就会很快的。

点开main.cpp就可以愉快的使用Arduino框架了

点击左下角的编译按钮也可成功编译(右边的按钮就是上传)

已有 3 条评论
  1. 评论头像

    It's remarkable to go to see this website and
    reading the views of all mates concerning this article, while
    I am also keen of getting knowledge.

    Subscribe today March 9th, 2025 at 07:48 pm 回复
  2. 评论头像

    Hi there! I realize this is somewhat off-topic
    however I had to ask. Does building a well-established blog like yours require a lot of work?
    I'm completely new to writing a blog however I do write in my diary on a
    daily basis. I'd like to start a blog so I can share my personal experience and views online.

    Please let me know if you have any recommendations or tips for brand new aspiring bloggers.
    Appreciate it!

    Contact us March 9th, 2025 at 07:54 pm 回复
  3. 评论头像

    Hello There. I found your blog using msn. This is an extremely well written article.
    I'll be sure to bookmark it and come back to read more of your useful information. Thanks
    for the post. I'll certainly return.

    Click here March 9th, 2025 at 08:46 pm 回复
发表新评论