From 018dc17593afe0ea0b784a1ecaf74d11f94d0def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=9F=E5=B8=85=E5=B8=85?= <18264798931@163.com> Date: Fri, 25 Oct 2024 12:05:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20Docs/2024-10-25?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ual Studio Code+PlatformIO IDE开发Arduino.md | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Docs/2024-10-25/3.使用Visual Studio Code+PlatformIO IDE开发Arduino.md diff --git a/Docs/2024-10-25/3.使用Visual Studio Code+PlatformIO IDE开发Arduino.md b/Docs/2024-10-25/3.使用Visual Studio Code+PlatformIO IDE开发Arduino.md new file mode 100644 index 0000000..8938d04 --- /dev/null +++ b/Docs/2024-10-25/3.使用Visual Studio Code+PlatformIO IDE开发Arduino.md @@ -0,0 +1,55 @@ +2024.10.19 + +Arduino + +创建项目: + +![image-20241019004914430](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410190049587.png) + +测试代码: + +![image-20241019005248711](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410190052780.png) + +虽说不用选端口,还是存一下,以免日后要用: + +![image-20241019005322216](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410190053245.png) + +点击这个,下载并编译: + +![2aaa6101e539345f8b3bb52cc7f991a4](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410190054717.png) + +可以看到开发板上指示灯L每隔1秒闪烁1毫秒,是代码中 + +delayMicroseconds(1000); + +delay(1000); + +控制的时间,而高低电平控制灯是否发光: + +digitalWrite(13, HIGH); + +digitalWrite(13, LOW); + +![arduino](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410231932717.webp) + +在Arduino板子上测试,会发现D13引脚指示灯按照程序设定闪烁。 + + + +PlatformIO库管理的例子: + +若我们想要使用TimerOne,在调用的时候如果我们没有这个库,就会出现无法调用的错误: + +![image-20241023193533347](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410231935394.png) + +此时,在platformio.ini中加入下面的代码,然后点击‘√’进行编译,就可以在控制台看到如下结果: + +![{5AA73C5D-0E01-45d3-8597-174674DD57FE}](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410231945949.png) + +然后,发现库可以正常调用了: + +![{89FCCDBD-97FC-4d14-BBCC-66DF69E3D2AF}](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410231947662.png) + +在下面的路径下找到了TimerOne: + +![image-20241023194500197](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202410231945275.png) \ No newline at end of file