当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 0

cjh0613/blog
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
20200630VScode-Arduino.html 46.48 KB
一键复制 编辑 原始数据 按行查看 历史
cjh0613 提交于 2021-08-17 09:02 . 更新网站 2021-08-17 09:01
<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="renderer" content="webkit"><meta name="force-rendering" content="webkit"><!----><script src="//cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script><script src="https://cdn.staticfile.org/layer/3.1.1/layer.min.js"></script><script src="/anti-selfish-browser/Browser.js"></script><script src="/anti-selfish-browser/anti-selfish-browser.js"></script><!----><meta name="format-detection" content="telephone=no"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><link rel="icon" href="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/images/icons/CJHicon.jpg?v=1.7.0" type="image/png" sizes="16x16"><link rel="icon" href="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/images/icons/CJHicon.jpg?v=1.7.0" type="image/png" sizes="32x32"><link rel="apple-touch-icon" href="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/images/icons/CJHicon.jpg?v=1.7.0" sizes="180x180"><link rel="mask-icon" href="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/images/icons/CJHicon.jpg?v=1.7.0" color="#54bcff"><meta name="msapplication-TileImage" content="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/images/icons/CJHicon.jpg"><meta name="msapplication-TileColor" content="#000000"><meta name="google-site-verification" content="WENVxYJ4LorKjirCAv6WnZEiM9vyEiZKmRIqaiTLOVw"><meta name="msvalidate.01" content="1995BB61A214C11B83C059025081A00C"><meta name="description" content="为什么要用VScode代替Arduino?因为它是最好的进行arduino开发的利器,支持许多Arduino IDE所没有的功能,其Arduino插件由微软开发,十分稳定。支持代码高亮,代码补全,转到定义,文件跳转等,有利于提高敲代码速度以及查看源码或者库文件。而且VScode可以跨平台使用,Windows,MAC,Linux都支持。而且没有vs那样臃肿,其他比较好的c语言IDE如Clion(ar">
<meta property="og:type" content="article">
<meta property="og:title" content="将Arduino项目导入VScode进行开发">
<meta property="og:url" content="https://cjh0613.com/20200630VScode-Arduino.html">
<meta property="og:site_name" content="峡州仙士之页">
<meta property="og:description" content="为什么要用VScode代替Arduino?因为它是最好的进行arduino开发的利器,支持许多Arduino IDE所没有的功能,其Arduino插件由微软开发,十分稳定。支持代码高亮,代码补全,转到定义,文件跳转等,有利于提高敲代码速度以及查看源码或者库文件。而且VScode可以跨平台使用,Windows,MAC,Linux都支持。而且没有vs那样臃肿,其他比较好的c语言IDE如Clion(ar">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cjh0613.com/images/pasted-53.png">
<meta property="og:image" content="https://cjh0613.com/images/pasted-53.png">
<meta property="og:image" content="https://cjh0613.com/images/pasted-54.png">
<meta property="og:image" content="https://cjh0613.com/images/pasted-55.png">
<meta property="article:published_time" content="2020-06-30T13:27:00.000Z">
<meta property="article:modified_time" content="2020-08-05T10:01:14.600Z">
<meta property="article:author" content="峡州仙士">
<meta property="article:tag" content="arduino">
<meta property="article:tag" content="vscode">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cjh0613.com/images/pasted-53.png"><meta name="keywords" content="峡州仙士, 峡州仙士之页"><title>将Arduino项目导入VScode进行开发 | 峡州仙士之页</title><link ref="canonical" href="https://cjh0613.com/20200630VScode-Arduino.html"><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><link rel="stylesheet" href="//cdn.staticfile.org/font-awesome/5.12.1/css/all.min.css" type="text/css"><link rel="stylesheet" href="//cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.css" type="text/css"><link rel="stylesheet" href="//cdn.staticfile.org/social-share.js/1.0.16/css/share.min.css" type="text/css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/css/index.css?v=1.7.0"><link rel="dns-prefetch" href="https://www.googletagmanager.com"><link rel="dns-prefetch" href="https://hm.baidu.com"><script src="https://www.googletagmanager.com/gtag/js?id=UA-168599388-1" async></script><script>if (window.location.hostname !== 'localhost') {
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-168599388-1');
}</script><script>var _hmt = _hmt || [];
(function() {
var hm = document.createElement('script');
hm.src = 'https://hm.baidu.com/hm.js?3571f7725019f0e61870427684c3ce17';
hm.async = true;
if (false) {
hm.setAttribute('data-pjax', '');
}
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
})();</script><script>var Stun = window.Stun || {};
var CONFIG = {
root: '/',
algolia: undefined,
fontIcon: {"prompt":{"success":"fas fa-check-circle","info":"fas fa-arrow-circle-right","warning":"fas fa-exclamation-circle","error":"fas fa-times-circle"},"copyBtn":"fas fa-copy"},
sidebar: {"offsetTop":"20px","tocMaxDepth":6},
header: {"enable":true,"showOnPost":true,"scrollDownIcon":false},
post_widget: {"end_text":true},
night_mode: {"enable":true},
back2top: {"enable":true},
codeblock: {"style":"default","highlight":"light","word_wrap":false},
reward: true,
fancybox: true,
zoom_image: {"enable":true,"mask_color":"rgba(0,0,0,0.6)"},
gallery_waterfall: {"enable":true,"col_width":"220px","gap_x":"10px","gap_y":"10px"},
lazyload: {"enable":true,"placeholder":"gif"},
pjax: undefined,
external_link: {"icon":{"enable":true,"name":"fas fa-external-link-alt"}},
shortcuts: undefined,
prompt: {"copy_button":"复制","copy_success":"复制成功","copy_error":"复制失败"},
sourcePath: {"js":"js","css":"css","images":"images"},
};
window.CONFIG = CONFIG;</script><meta name="generator" content="Hexo 4.2.0"></head><body><div class="container" id="container"><header class="header" id="header"><div class="header-inner"><nav class="header-nav header-nav--fixed"><div class="header-nav-inner"><div class="header-nav-menubtn"><i class="fas fa-bars"></i></div><div class="header-nav-menu"><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/"><span class="header-nav-menu-item__icon"><i class="fas fa-home"></i></span><span class="header-nav-menu-item__text">首页</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/archives/"><span class="header-nav-menu-item__icon"><i class="fas fa-folder-open"></i></span><span class="header-nav-menu-item__text">归档</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/categories/"><span class="header-nav-menu-item__icon"><i class="fas fa-layer-group"></i></span><span class="header-nav-menu-item__text">分类</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/tags/"><span class="header-nav-menu-item__icon"><i class="fas fa-tags"></i></span><span class="header-nav-menu-item__text">标签</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="https://en.cjh0613.com/" target="_blank" rel="noopener"><span class="header-nav-menu-item__icon"><i class="fas fa-language"></i></span><span class="header-nav-menu-item__text">En</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="javascript:;" onclick="return false;"><span class="header-nav-menu-item__icon"><i class="fas fa-ellipsis-h"></i></span><span class="header-nav-menu-item__text">其他菜单项</span></a><div class="header-nav-submenu"><div class="header-nav-submenu-item"><a class="header-nav-submenu-item__link" href="/about.html"><span class="header-nav-submenu-item__icon"><i class="fas fa-user"></i></span><span class="header-nav-submenu-item__text">关于我</span></a></div><div class="header-nav-submenu-item"><a class="header-nav-submenu-item__link" href="/hot.html"><span class="header-nav-submenu-item__icon"><i class="fas fa-paper-plane"></i></span><span class="header-nav-submenu-item__text">热门文章</span></a></div><div class="header-nav-submenu-item"><a class="header-nav-submenu-item__link" href="https://suiji.cjh0613.com/" target="_blank" rel="external nofollow noopener noreferrer"><span class="header-nav-submenu-item__icon"><i class="fas fa-history"></i></span><span class="header-nav-submenu-item__text">随记</span></a></div><div class="header-nav-submenu-item"><a class="header-nav-submenu-item__link" href="/ask.html"><span class="header-nav-submenu-item__icon"><i class="fas fa-question"></i></span><span class="header-nav-submenu-item__text">留言/提问</span></a></div><div class="header-nav-submenu-item"><a class="header-nav-submenu-item__link" href="/friends/"><span class="header-nav-submenu-item__icon"><i class="fas fa-users"></i></span><span class="header-nav-submenu-item__text">朋友</span></a></div></div></div></div><div class="header-nav-search"><span class="header-nav-search__icon"><i class="fas fa-search"></i></span><span class="header-nav-search__text">搜索</span></div><div class="header-nav-mode"><div class="mode"><div class="mode-track"><span class="mode-track-moon"></span><span class="mode-track-sun"></span></div><div class="mode-thumb"></div></div></div></div></nav><div class="header-banner"><div class="header-banner-info"><div class="header-banner-info__title">世上本没有路</div><div class="header-banner-info__subtitle">峡州仙士之页</div><!--br--><!--div.header-banner-info__btn--></div><div class="cjh-btn"><div class="cjh-btn__icon"><a class="cjh-btn-a" href="/index.html" target="_blank" rel="noopener">移步首页</a></div></div></div></div></header><main class="main" id="main"><div class="main-inner"><div class="content-wrap" id="content-wrap"><div class="content" id="content"><!-- Just used to judge whether it is an article page--><div id="is-post"></div><div class="post"><header class="post-header"><h1 class="post-title">将Arduino项目导入VScode进行开发</h1><div class="post-meta"><span class="post-meta-item post-meta-item--createtime"><span class="post-meta-item__icon"><i class="far fa-calendar-plus"></i></span><span class="post-meta-item__info">发表</span><span class="post-meta-item__value">2020-06-30</span></span><span class="post-meta-item post-meta-item--updatetime"><span class="post-meta-item__icon"><i class="far fa-calendar-check"></i></span><span class="post-meta-item__info">更新</span><span class="post-meta-item__value">2020-08-05</span></span><span class="post-meta-item post-meta-item--wordcount"><span class="post-meta-item__icon"><i class="far fa-file-word"></i></span><span class="post-meta-item__info">字数</span><span class="post-meta-item__value">613</span></span><span class="post-meta-item post-meta-item--readtime"><span class="post-meta-item__icon"><i class="far fa-clock"></i></span><span class="post-meta-item__info">预计阅读时长</span><span class="post-meta-item__value">5分</span></span><span class="post-meta-item post-meta-item--visitors"><span class="post-meta-item__icon"><i class="fas fa-eye"></i></span><span class="post-meta-item__info">阅读次数</span><span class="post-meta-item__value" id="busuanzi_value_page_pv"></span></span></div><div class="post-tags"><span class="post-tags-item"><span class="post-tags-item__icon"><i class="fas fa-tag"></i></span><a class="post-tags-item__link" href="tags/arduino/">arduino</a></span><span class="post-tags-item"><span class="post-tags-item__icon"><i class="fas fa-tag"></i></span><a class="post-tags-item__link" href="tags/vscode/">vscode</a></span></div></header><div class="post-body"><p>为什么要用<code>VScode</code>代替<code>Arduino</code>?因为它是最好的进行arduino开发的利器,支持许多<code>Arduino IDE</code>所没有的功能,其<code>Arduino</code>插件由微软开发,十分稳定。支持<strong>代码高亮,代码补全,转到定义,文件跳转</strong>等,有利于提高敲代码速度以及查看源码或者库文件。而且<code>VScode</code>可以跨平台使用,<code>Windows</code><code>MAC</code><code>Linux</code>都支持。而且没有<code>vs</code>那样臃肿,其他比较好的c语言IDE如Clion(arduino插件由个人开发,相比vs系列,用户较少)的支持都不太好。</p>
<a id="more"></a>
<h2 id="安装插件">
<span class="heading-link">安装插件</span>
</h2>
<p>步骤 1: 左键单击左下角齿轮设置按钮<br>
<img class="lazyload lazyload-gif" src="/images/loading.svg" data-src="/images/pasted-53.png" alt="左下角齿轮设置按钮">
</p>
<p>步骤 2: 中左键单击菜单中拓展</p>
<p>步骤 3: 在搜索框输入arduino并安装(还需要安装 C/C++ 插件)</p>
<h2 id="修改vscode设置">
<span class="heading-link">修改VScode设置</span>
</h2>
<p>步骤 1: 左键单击左下角齿轮设置按钮</p>
<p>
<img class="lazyload lazyload-gif" src="/images/loading.svg" data-src="/images/pasted-53.png" alt="左下角齿轮设置按钮">
</p>
<p>步骤 2: 点击&quot;设置 &quot;</p>
<p>
<img class="lazyload lazyload-gif" src="/images/loading.svg" data-src="/images/pasted-54.png" alt="设置">
</p>
<p>步骤 3: 在&quot;设置 &quot;中左键单击右上角“打开json设置”按钮</p>
<p>
<img class="lazyload lazyload-gif" src="/images/loading.svg" data-src="/images/pasted-55.png" alt="右上角“打开json设置”按钮">
</p>
<p>步骤 4: 添加下方内容至括号中</p>
<figure class="highlight plain"><div class="table-container"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">&quot;arduino.path&quot;: &quot;C:&#x2F;Program Files (x86)&#x2F;Arduino&quot;, </span><br><span class="line">&quot;C_Cpp.intelliSenseEngine&quot;: &quot;Tag Parser&quot;, </span><br><span class="line">&quot;editor.insertSpaces&quot;: true, </span><br><span class="line">&quot;files.autoGuessEncoding&quot;: true, </span><br><span class="line">&quot;arduino.logLevel&quot;: &quot;info&quot;, </span><br><span class="line">&quot;explorer.confirmDelete&quot;: false, </span><br><span class="line">&quot;editor.detectIndentation&quot;: false,</span><br></pre></td></tr></table></div></figure>
<p>我的完整配置:</p>
<figure class="highlight json"><div class="table-container"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line"> <span class="attr">"git.path"</span>: <span class="string">"D:/mypro/PortableGit/bin/git.exe"</span>,</span><br><span class="line"> <span class="attr">"workbench.colorTheme"</span>: <span class="string">"Default Light+"</span>,</span><br><span class="line"> <span class="attr">"editor.tabCompletion"</span>: <span class="string">"on"</span>,</span><br><span class="line"> <span class="attr">"arduino.path"</span>: <span class="string">"C:/Program Files (x86)/Arduino"</span>, </span><br><span class="line"> <span class="attr">"C_Cpp.intelliSenseEngine"</span>: <span class="string">"Tag Parser"</span>, </span><br><span class="line"> <span class="attr">"editor.insertSpaces"</span>: <span class="literal">true</span>, </span><br><span class="line"> <span class="attr">"files.autoGuessEncoding"</span>: <span class="literal">true</span>, </span><br><span class="line"> <span class="attr">"arduino.logLevel"</span>: <span class="string">"info"</span>, </span><br><span class="line"> <span class="attr">"explorer.confirmDelete"</span>: <span class="literal">false</span>, </span><br><span class="line"> <span class="attr">"editor.detectIndentation"</span>: <span class="literal">false</span>,</span><br><span class="line">&#125;</span><br></pre></td></tr></table></div></figure>
<p>如此便可使用代码补全了</p>
<h2 id="修改arduino项目vscode配置文件">
<span class="heading-link">修改Arduino项目VScode配置文件</span>
</h2>
<div class="note-plugin warning no-icon">
<p><strong>警告</strong><br>我实际测试中发现依然无法成功编译上传……</p>
</div>
<p>目的是让VScode识别Arduino项目</p>
<p>参照下方添加/修改项目根目录<code>.vscode/C_cpp_properties.json</code>文件,请注意使用对应安装目录、我的文档arduino库目录:</p>
<figure class="highlight json"><div class="table-container"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line"> <span class="attr">"configurations"</span>: [</span><br><span class="line"> &#123;</span><br><span class="line"> <span class="attr">"name"</span>: <span class="string">"Win32"</span>,</span><br><span class="line"> <span class="attr">"includePath"</span>: [</span><br><span class="line"> <span class="string">"C:/Program Files (x86)/Arduino/libraries"</span>,</span><br><span class="line"> <span class="string">"C:/Program Files (x86)/Arduino/hardware/arduino/avr/**"</span>,</span><br><span class="line"> <span class="string">"C:/Program Files (x86)/Arduino/hardware/tools/avr/avr/include"</span>,</span><br><span class="line"> <span class="string">"C:/Program Files (x86)/Arduino/hardware/tools/avr/lib/gcc/avr/7.3.0/include"</span>,</span><br><span class="line"> <span class="string">"C:/Program Files (x86)/Arduino/hardware/tools/avr/lib/gcc/avr/7.3.0/include-fixed"</span>,</span><br><span class="line"> <span class="string">"C:/Program Files (x86)/Arduino/tools/**"</span></span><br><span class="line"> ],</span><br><span class="line"> <span class="attr">"forcedInclude"</span>: [</span><br><span class="line"> <span class="string">"C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/Arduino.h"</span></span><br><span class="line"> ],</span><br><span class="line"> <span class="attr">"browse"</span>: &#123;</span><br><span class="line"> <span class="attr">"limitSymbolsToIncludedHeaders"</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="attr">"path"</span>: [</span><br><span class="line"> <span class="string">"C:/Program Files (x86)/Arduino/libraries"</span></span><br><span class="line"> ]</span><br><span class="line"> &#125;,</span><br><span class="line"> <span class="attr">"intelliSenseMode"</span>: <span class="string">"msvc-x64"</span>,</span><br><span class="line"> <span class="attr">"defines"</span>: [</span><br><span class="line"> <span class="string">"USBCON"</span></span><br><span class="line"> ]</span><br><span class="line"> &#125;</span><br><span class="line"> ],</span><br><span class="line"> <span class="attr">"version"</span>: <span class="number">4</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></div></figure>
<h2 id="参考资料">
<span class="heading-link">参考资料</span>
</h2>
<div class="table-container"><table>
<thead>
<tr>
<th style="text-align:center">网页链接</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><span class="exturl"><a class="exturl__link" href="https://blog.csdn.net/acktomas/article/details/102815385" target="_blank" rel="external nofollow noopener noreferrer">https://blog.csdn.net/acktomas/article/details/102815385</a><span class="exturl__icon"><i class="fas fa-external-link-alt"></i></span></span></td>
</tr>
<tr>
<td style="text-align:center"><span class="exturl"><a class="exturl__link" href="https://www.csdn.net/gather_2d/MtTaggysNzQzOS1ibG9n.html" target="_blank" rel="external nofollow noopener noreferrer">https://www.csdn.net/gather_2d/MtTaggysNzQzOS1ibG9n.html</a><span class="exturl__icon"><i class="fas fa-external-link-alt"></i></span></span></td>
</tr>
<tr>
<td style="text-align:center"><span class="exturl"><a class="exturl__link" href="https://mithatkonar.com/wiki/doku.php/arduino/configuring_visual_studio_code_for_arduino_development" target="_blank" rel="external nofollow noopener noreferrer">https://mithatkonar.com/wiki/doku.php/arduino/configuring_visual_studio_code_for_arduino_development</a><span class="exturl__icon"><i class="fas fa-external-link-alt"></i></span></span></td>
</tr>
<tr>
<td style="text-align:center"><span class="exturl"><a class="exturl__link" href="https://mithatkonar.com/wiki/doku.php/arduino/code_completion" target="_blank" rel="external nofollow noopener noreferrer">https://mithatkonar.com/wiki/doku.php/arduino/code_completion</a><span class="exturl__icon"><i class="fas fa-external-link-alt"></i></span></span></td>
</tr>
<tr>
<td style="text-align:center"><span class="exturl"><a class="exturl__link" href="https://sunmengxin.cn/vscode-replace-arduino/" target="_blank" rel="external nofollow noopener noreferrer">https://sunmengxin.cn/vscode-replace-arduino/</a><span class="exturl__icon"><i class="fas fa-external-link-alt"></i></span></span></td>
</tr>
<tr>
<td style="text-align:center"><span class="exturl"><a class="exturl__link" href="https://blog.csdn.net/yanggengzhen/article/details/103900182" target="_blank" rel="external nofollow noopener noreferrer">https://blog.csdn.net/yanggengzhen/article/details/103900182</a><span class="exturl__icon"><i class="fas fa-external-link-alt"></i></span></span></td>
</tr>
<tr>
<td style="text-align:center"><span class="exturl"><a class="exturl__link" href="https://www.ancii.com/agzua0dgq/" target="_blank" rel="external nofollow noopener noreferrer">https://www.ancii.com/agzua0dgq/</a><span class="exturl__icon"><i class="fas fa-external-link-alt"></i></span></span></td>
</tr>
</tbody>
</table></div>
</div><footer class="post-footer"><div class="post-ending ending"><div class="ending__text">------ 本文结束,感谢您的阅读 ------</div></div><div class="post-copyright copyright"><div class="copyright-author"><span class="copyright-author__name">本文作者: </span><span class="copyright-author__value"><a href="https://cjh0613.com">峡州仙士</a></span></div><div class="copyright-link"><span class="copyright-link__name">原文链接: </span><span class="copyright-link__value"><a href="https://cjh0613.com/20200630VScode-Arduino.html">https://cjh0613.com/20200630VScode-Arduino.html</a></span></div><div class="copyright-notice"><span class="copyright-notice__name">声明: </span><span class="copyright-notice__value">如文章有更新,将先在本网站(峡州仙士之页)发布!(可百度)| 本网站所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="external nofollow noopener noreferrer" target="_blank">BY-NC-SA</a> 许可协议。转载请注明出处!</span></div></div><div class="post-tags"><span class="post-tags-item"><span class="post-tags-item__icon"><i class="fas fa-tag"></i></span><a class="post-tags-item__link" href="tags/arduino/">arduino</a></span><span class="post-tags-item"><span class="post-tags-item__icon"><i class="fas fa-tag"></i></span><a class="post-tags-item__link" href="tags/vscode/">vscode</a></span></div><div class="post-share"><div class="social-share" data-sites="qzone, qq, weibo, wechat, douban, linkedin, facebook, twitter, google">分享本文到: </div></div><div class="post-reward reward"><div class="reward-button">请我喝一杯凉虾~</div><div class="reward-qrcode"><a class="exturl__link" href="https://www.cjh0613.com/RedEnvelope" target="_blank" rel="external nofollow noopener noreferrer">(推荐)【免费打赏】手机用户点此一键领红包,您通过使用红包来支持站长</a><p>BTC地址(建议使用ETH):3F7hk94nnBHrL4LuHZdtP4soPCefCV6CbU</p><p>ETH收款地址:0x2AdDE524665af970acE4CB3D50dE70136c88f90F</p><span class="reward-qrcode-alipay"><img class="reward-qrcode-alipay__img" src="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/images/pasted-5.png"><div class="reward-qrcode-alipay__text">支付宝打赏</div></span><span class="reward-qrcode-wechat"><img class="reward-qrcode-wechat__img" src="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/images/pasted-6.png"><div class="reward-qrcode-wechat__text">微信打赏</div></span></div></div><nav class="post-paginator paginator"><div class="paginator-prev"><a class="paginator-prev__link" href="/20200702lanzous.html"><span class="paginator-prev__icon"><i class="fas fa-angle-left"></i></span><span class="paginator-prev__text">无法打开lanzous蓝奏云网盘下载的解决方法</span></a></div><div class="paginator-next"><a class="paginator-next__link" href="/20200616win10HotKey.html"><span class="paginator-prev__text">win10快捷键与小工具</span><span class="paginator-next__icon"><i class="fas fa-angle-right"></i></span></a></div></nav></footer></div></div><div class="comments" id="comments"><div id="waline-container"></div></div></div><div class="sidebar-wrap" id="sidebar-wrap"><aside class="sidebar" id="sidebar"><div class="sidebar-nav"><span class="sidebar-nav-toc current">文章目录</span><span class="sidebar-nav-ov">站点概览</span></div><section class="sidebar-toc"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#安装插件"><span class="toc-number">1.</span> <span class="toc-text">
安装插件
</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#修改vscode设置"><span class="toc-number">2.</span> <span class="toc-text">
修改VScode设置
</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#修改arduino项目vscode配置文件"><span class="toc-number">3.</span> <span class="toc-text">
修改Arduino项目VScode配置文件
</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#参考资料"><span class="toc-number">4.</span> <span class="toc-text">
参考资料
</span></a></li></ol></section><!-- ov = overview--><section class="sidebar-ov hide"><div class="sidebar-ov-author"><div class="sidebar-ov-author__avatar"><img class="sidebar-ov-author__avatar_img" src="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/images/icons/CJHicon.jpg" alt="avatar"></div><p class="sidebar-ov-author__text">这里也有我的痕迹(按排序):</p></div><div class="sidebar-ov-social"><a class="sidebar-ov-social-item" href="/20200402RSS.html" target="_blank" rel="noopener" data-popover="RSS订阅" data-popover-pos="up"><span class="sidebar-ov-social-item__icon"><i class="fas fa-rss"></i></span></a><a class="sidebar-ov-social-item" href="https://github.com/cjh0613" target="_blank" rel="external nofollow noopener noreferrer" data-popover="Github" data-popover-pos="up"><span class="sidebar-ov-social-item__icon"><i class="fab fa-github"></i></span></a><a class="sidebar-ov-social-item" href="https://www.thingiverse.com/cjh0613" target="_blank" rel="external nofollow noopener noreferrer" data-popover="Thingiverse" data-popover-pos="up"><span class="sidebar-ov-social-item__icon"><i class="fas fa-cube"></i></span></a><a class="sidebar-ov-social-item" href="https://t.me/cjh0613" target="_blank" rel="external nofollow noopener noreferrer" data-popover="Telegram" data-popover-pos="up"><span class="sidebar-ov-social-item__icon"><i class="fab fa-telegram"></i></span></a><a class="sidebar-ov-social-item" href="https://www.quora.com/profile/Bruce-Chen-199" target="_blank" rel="external nofollow noopener noreferrer" data-popover="Quora" data-popover-pos="up"><span class="sidebar-ov-social-item__icon"><i class="fab fa-quora"></i></span></a><a class="sidebar-ov-social-item" href="https://www.zhihu.com/people/cjh0613" target="_blank" rel="external nofollow noopener noreferrer" data-popover="知乎" data-popover-pos="up"><span class="sidebar-ov-social-item__icon"><i class="fas fa-question"></i></span></a><a class="sidebar-ov-social-item" href="/about.html" target="_blank" rel="noopener" data-popover="更多" data-popover-pos="up"><span class="sidebar-ov-social-item__icon"><i class="fas fa-ellipsis-h"></i></span></a></div><div class="sidebar-ov-state"><a class="sidebar-ov-state-item sidebar-ov-state-item--posts" href="/archives/"><div class="sidebar-ov-state-item__count">102</div><div class="sidebar-ov-state-item__name">归档</div></a><a class="sidebar-ov-state-item sidebar-ov-state-item--categories" href="/categories/"><div class="sidebar-ov-state-item__count">6</div><div class="sidebar-ov-state-item__name">分类</div></a><a class="sidebar-ov-state-item sidebar-ov-state-item--tags" href="/tags/"><div class="sidebar-ov-state-item__count">66</div><div class="sidebar-ov-state-item__name">标签</div></a></div><div class="sidebar-ov-cc"><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="external nofollow noopener noreferrer" data-popover="知识共享" data-popover-pos="up"><img src="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/images/cc-by-nc-sa.svg"></a></div></section><div class="sidebar-reading"><div class="sidebar-reading-info"><span class="sidebar-reading-info__text">你已阅读了 </span><span class="sidebar-reading-info__num">0</span></div><div class="sidebar-reading-line"></div></div></aside></div><div class="clearfix"></div></div></main><footer class="footer" id="footer"><div class="footer-inner"><div><span>Copyright © 2020~2021</span><span class="footer__icon"><i class="fas fa-code"></i></span><span>峡州仙士</span><span class="footer__devider">|</span><span>粤ICP备12009483号(Gitee站)</span></div><!----><div class="busuanzi"><span class="busuanzi-siteuv"><span class="busuanzi-siteuv__icon"><i class="fas fa-user"></i></span><span class="busuanzi-siteuv__info">访问人数</span><span class="busuanzi-siteuv__value" id="busuanzi_value_site_uv"></span></span><span class="busuanzi-sitepv"><span class="busuanzi-siteuv__icon"><i class="fas fa-eye"></i></span><span class="busuanzi-siteuv__info">浏览总量</span><span class="busuanzi-siteuv__value" id="busuanzi_value_site_pv"></span></span></div><div>推荐使用电脑端访问本站</div><div class="webinfo-item"><span class="webinfo-runtime-name">本站持续运行时间 :</span><span class="webinfo-runtime-count" id="webinfo-runtime-count" start_date="2020/2/26 00:00:00"></span></div><div style="display:none"><script type="text/javascript" src="https://js.users.51.la/20667167.js"></script><script src="https://s96.cnzz.com/z_stat.php?id=1277785770&amp;web_id=1277785770"></script></div><div><p><a class="exturl__link" href="/20200402RSS.html" target="_blank" rel="noopener">RSS</a>&nbsp;|&nbsp;<a class="exturl__link" href="https://en.cjh0613.com/index.html" target="_blank" rel="noopener">English&emsp;I18N&emsp;国际站</a>&nbsp;|&nbsp;<a class="exturl__link" href="https://status.cjh0613.com/" target="_blank" rel="external nofollow noopener noreferrer">峡州仙士之页状态监控</a><br><a class="exturl__link" href="https://suyin-blog.club/" target="_blank" rel="noopener">苏寅</a>&nbsp;|&nbsp;<a class="exturl__link" href="https://www.avg.cx" target="_blank" rel="noopener">Yrh</a>&nbsp;|&nbsp;<a class="exturl__link" href="https://www.v6g.cn/" target="_blank" rel="noopener">微6g资源网</a><br><a class="exturl__link" href="https://cjh0613.com/archives/index.html" target="_blank" rel="noopener">归档页</a>&nbsp;|&nbsp;
sitemap(<a class="exturl__link" href="https://cjh0613.com/sitemap.xml" target="_blank" rel="noopener">1</a><a class="exturl__link" href="https://cjh0613.com/google-sitemap.xml" target="_blank" rel="noopener">2</a>
&nbsp;|&nbsp;<a class="exturl__link" href="/friends/index.html" target="_blank" rel="noopener">更多友情链接</a></p></div></div></footer><div class="loading-bar" id="loading-bar"><div class="loading-bar__progress"></div></div><div class="back2top" id="back2top"><span class="back2top__icon"><i class="fas fa-rocket"></i></span></div></div><div class="search-mask"></div><script>//var btn = document.getElementById("cjh_search");
function cjh_search(){
var $input = $('.search-input input');var q = $input.val().toLowerCase().trim();
var url = "https://www.baidu.com/s";
var url = url + '?wd='+q+' "峡州仙士之页"';
if(q){
var tempwindow=window.open('_blank');
tempwindow.location=url;
}}
function cjh_g_search(){
var $input = $('.search-input input');var q = $input.val().toLowerCase().trim();
var url = "https://www.sanzhima.com/search";
var url = url + '?q='+q+' site:cjh0613.com';
if(q){
var tempwindow=window.open('_blank');
tempwindow.location=url;
}}
</script><div class="search-popup"><span class="search-close"></span><div class="search-input"><input placeholder="搜索文章(支持多关键词,请用空格分隔)"><div class="cjh-btn__icon" style="font-size:1rem"><a class="cjh-btn-a" href="javascript:;" onclick="cjh_g_search();return false;">谷歌搜索</a>&emsp;<a class="cjh-btn-a" id="cjh_search" href="javascript:;" onclick="cjh_search();return false;">备用搜索</a></div><div style="text-align: center"><p>(您还可以在<a class="exturl__link" href="/blog/archives/" target="_blank" rel="noopener">归档页</a>搜索文章标题)</p></div></div><div class="search-results"></div></div><script src="//cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script><script src="//cdn.staticfile.org/velocity/1.5.2/velocity.min.js"></script><script src="//cdn.staticfile.org/velocity/1.5.2/velocity.ui.min.js"></script><script src="//cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.js"></script><script src="//cdn.staticfile.org/masonry/4.2.2/masonry.pkgd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/lazyload.min.js"></script><script src="//cdn.staticfile.org/social-share.js/1.0.16/js/social-share.min.js"></script><script>function initSearch() {
var isXML = true;
var search_path = 'search.json';
if (!search_path) {
search_path = 'search.xml';
} else if (/json$/i.test(search_path)) {
isXML = false;
}
var path = '/' + search_path;
$.ajax({
url: path,
dataType: isXML ? 'xml' : 'json',
async: true,
success: function (res) {
var datas = isXML ? $('entry', res).map(function () {
// 将 XML 转为 JSON
return {
title: $('title', this).text(),
content: $('content', this).text(),
url: $('url', this).text()
};
}).get() : res;
var $input = $('.search-input input');
var $result = $('.search-results');
// 搜索对象(标题、内容)的权重,影响显示顺序
var WEIGHT = { title: 100, content: 1 };
var searchPost = function () {
var searchText = $input.val().toLowerCase().trim();
// 根据空白字符分隔关键字
var keywords = searchText.split(/[\s]+/);
// 搜索结果
var matchPosts = [];
// 有多个关键字时,将原文字整个保存下来
if (keywords.length > 1) {
keywords.push(searchText);
}
// 防止未输入字符时搜索
if (searchText.length > 0) {
datas.forEach(function (data) {
var isMatch = false;
// 没有标题的文章使用预设的 i18n 变量代替
var title = (data.title && data.title.trim()) || '[ 文章无标题 ]';
var titleLower = title && title.toLowerCase();
// 删除 HTML 标签 和 所有空白字符
var content = data.content && data.content.replace(/<[^>]+>/g, '');
var contentLower = content && content.toLowerCase();
// 删除重复的 /
var postURL = data.url && decodeURI(data.url).replace(/\/{2,}/g, '/');
// 标题中匹配到的关键词
var titleHitSlice = [];
// 内容中匹配到的关键词
var contentHitSlice = [];
keywords.forEach(function (keyword) {
/**
* 获取匹配的关键词的索引
* @param {String} keyword 要匹配的关键字
* @param {String} text 原文字
* @param {Boolean} caseSensitive 是否区分大小写
* @param {Number} weight 匹配对象的权重。权重大的优先显示
* @return {Array}
*/
function getIndexByword (word, text, caseSensitive, weight) {
if (!word || !text) {
return [];
};
var startIndex = 0; // 每次匹配的开始索引
var index = -1; // 匹配到的索引值
var result = []; // 匹配结果
if (!caseSensitive) {
word = word.toLowerCase();
text = text.toLowerCase();
}
while((index = text.indexOf(word, startIndex)) !== -1) {
var hasMatch = false;
// 索引位置相同的关键词,保留长度较长的
titleHitSlice.forEach(function (hit) {
if (hit.index === index && hit.word.length < word.length) {
hit.word = word;
hasMatch = true;
}
});
startIndex = index + word.length;
!hasMatch && result.push({ index: index, word: word, weight: weight });
}
return result;
}
titleHitSlice = titleHitSlice.concat(getIndexByword(keyword, titleLower, false, WEIGHT.title));
contentHitSlice = contentHitSlice.concat(getIndexByword(keyword, contentLower, false, WEIGHT.content));
});
var hitTitle = titleHitSlice.length;
var hitContent = contentHitSlice.length;
if (hitTitle > 0 || hitContent > 0) {
isMatch = true;
}
if (isMatch) {
;[titleHitSlice, contentHitSlice].forEach(function (hit) {
// 按照匹配文字的索引的递增顺序排序
hit.sort(function (left, right) {
return left.index - right.index;
});
});
/**
* 给文本中匹配到的关键词添加标记,从而进行高亮显示
* @param {String} text 原文本
* @param {Array} hitSlice 匹配项的索引信息
* @param {Number} start 开始索引
* @param {Number} end 结束索引
* @return {String}
*/
function highlightKeyword (text, hitSlice, start, end) {
if (!text || !hitSlice || !hitSlice.length) {
return;
}
var result = '';
var startIndex = start;
var endIndex = end;
hitSlice.forEach(function (hit) {
if (hit.index < startIndex) {
return;
}
var hitWordEnd = hit.index + hit.word.length;
result += text.slice(startIndex, hit.index);
result += '<b>' + text.slice(hit.index, hitWordEnd) + '</b>';
startIndex = hitWordEnd;
});
result += text.slice(startIndex, endIndex);
return result;
}
var postData = {};
// 文章总的搜索权重
var postWeight = titleHitSlice.length * WEIGHT.title + contentHitSlice.length * WEIGHT.content;
// 标记匹配关键词后的标题
var postTitle = highlightKeyword(title, titleHitSlice, 0, title.length) || title;
// 标记匹配关键词后的内容
var postContent;
// 显示内容的长度
var SHOW_WORD_LENGTH = 200;
// 命中关键词前的字符显示长度
var SHOW_WORD_FRONT_LENGTH = 20;
var SHOW_WORD_END_LENGTH = SHOW_WORD_LENGTH - SHOW_WORD_FRONT_LENGTH;
// 截取匹配的第一个字符,前后共 200 个字符来显示
if (contentHitSlice.length > 0) {
var firstIndex = contentHitSlice[0].index;
var start = firstIndex > SHOW_WORD_FRONT_LENGTH ? firstIndex - SHOW_WORD_FRONT_LENGTH : 0;
var end = firstIndex + SHOW_WORD_END_LENGTH;
postContent = highlightKeyword(content, contentHitSlice, start, end);
} else { // 未匹配到内容,直接截取前 200 个字符来显示
postContent = content.slice(0, SHOW_WORD_LENGTH);
}
postData.title = postTitle;
postData.content = postContent;
postData.url = postURL;
postData.weight = postWeight;
matchPosts.push(postData);
}
});
}
var resultInnerHtml = '';
if (matchPosts.length) {
// 按权重递增的顺序排序,使权重大的优先显示
matchPosts.sort(function (left, right) {
return right.weight - left.weight;
});
resultInnerHtml += '<ul>';
matchPosts.forEach(function (post) {
resultInnerHtml += '<li><a class="search-results-title" href="' + post.url + '">';
resultInnerHtml += post.title;
resultInnerHtml += '</a><div class="search-results-content">';
resultInnerHtml += post.content;
resultInnerHtml += '</div></li>';
});
resultInnerHtml += '</ul>';
} else {
resultInnerHtml += '<div class="search-results-none"><i class="far fa-meh"></i></div>';
}
$result.html(resultInnerHtml);
};
$input.on('input', searchPost);
$input.on('keypress', function (e) {
if (e.keyCode === Stun.utils.codeToKeyCode('Enter')) {
searchPost();
}
});
}
});
}
function closeSearch () {
$('body').css('overflow', 'auto');
$('.search-popup')
.removeClass('show')
.velocity('stop')
.velocity('transition.expandOut', {
duration: 300
});
$('.search-mask')
.velocity('stop')
.velocity('transition.fadeOut', {
duration: 300
});
}
window.addEventListener('DOMContentLoaded', function () {
Stun.utils.pjaxReloadLocalSearch = function () {
$('.header-nav-search').on('click', function (e) {
e.stopPropagation();
$('body').css('overflow', 'hidden');
$('.search-popup')
.addClass('show')
.velocity('stop')
.velocity('transition.expandIn', {
duration: 300,
complete: function () {
$('.search-popup input').focus();
}
});
$('.search-mask')
.velocity('stop')
.velocity('transition.fadeIn', {
duration: 300
});
initSearch();
});
$('.search-mask, .search-close').on('click', function () {
closeSearch();
});
$(document).on('keydown', function (e) {
// Escape <=> 27
if (e.keyCode === Stun.utils.codeToKeyCode('Escape')) {
closeSearch();
}
});
};
Stun.utils.pjaxReloadLocalSearch();
}, false);</script><link href="https://cdn.staticfile.org/KaTeX/0.10.2/katex.min.css" rel="stylesheet" type="text/css"><link href="https://cdn.staticfile.org/KaTeX/0.10.2/contrib/copy-tex.css" rel="stylesheet" type="text/css"><script src="https://cdn.staticfile.org/KaTeX/0.10.2/contrib/copy-tex.min.js"></script><script src="https://cdn.jsdelivr.net/gh/sukkaw/busuanzi@latest/bsz.pure.mini.js" async></script><script src="https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js"></script><script>function loadWaline () {
var GUEST_INFO = ['nick', 'mail', 'link'];
var guest_info = 'nick,mail,link';
guest_info = guest_info.split(',').filter(function(item) {
return GUEST_INFO.indexOf(item) > -1;
});
new Waline({
el: '#waline-container',
serverURL: 'https://comment.cjh0613.com',
placeholder: '点这里输入评论。如果您需要咨询,还可TG联系。(请填写上方昵称与邮箱,邮箱不会公开显示。如果您有个人网站,也可以填写)',
pageSize: '10' || 10,
lang: '' || 'zh-cn',
visitor: false,
avatar: 'mp',
path: window.location.pathname,
meta: guest_info,
avatarCDN: 'https://dn-qiniu-avatar.qbox.me/avatar/',
langMode: { admin: '站长' }
//- avatarCDN: 'https://sdn.geekzu.org/avatar/'
});
}
if (false) {
loadWaline();
} else {
window.addEventListener('DOMContentLoaded', loadWaline, false);
}</script><script src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" async></script><script>(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: 'ca-pub-3992225808017393',
enable_page_level_ads: true
});</script><script src="https://cjh0613.com/js/counttime.js"></script><script src="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/js/utils.js?v=1.7.0"></script><script src="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/js/stun-boot.js?v=1.7.0"></script><script src="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/js/scroll.js?v=1.7.0"></script><script src="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/js/header.js?v=1.7.0"></script><script src="https://cdn.jsdelivr.net/gh/cjh0613/blog@master/js/sidebar.js?v=1.7.0"></script></body></html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/cjh0613/blog.git
[email protected]:cjh0613/blog.git
cjh0613
blog
blog
master

搜索帮助