上传文件至 Docs/2024-10-25
parent
1fb38e48eb
commit
018dc17593
|
@ -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)
|
Loading…
Reference in New Issue