Skip to content

Commit 0d73b77

Browse files
author
flame.yu
committed
NEW: Add help documentation
1 parent 19aa16a commit 0d73b77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2188
-0
lines changed

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd
Loading
55.1 KB
Loading
38.7 KB
Loading

docs/source/_templates/backup.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
2+
3+
## Arduino函数
4+
5+
### 1 入口函数
6+
7+
#### setup()
8+
9+
Arduino控制器通电或复位后,即会开始执行setup() 函数中的程序,该部分只会执行一次。通常我们会在setup() 函数中完成Arduino的初始化设置,如配置I/O口状态,初始化串口等操作。
10+
11+
#### loop()
12+
13+
在setup() 函数中的程序执行完后,Arduino会接着执行loop() 函数中的程序。而loop()函数是一个死循环,其中的程序会不断的重复运行。通常我们会在loop() 函数中完成程序的主要功能,如驱动各种模块,采集数据等。
14+
15+
### 2 数字输入/输出
16+
17+
- [x] pinMode(pin, mode)
18+
19+
在使用输入或输出功能前,你需要先通过pinMode() 函数配置引脚的模式为输入模式或输出模式。
20+
21+
- [x] digitalWrite(pin, value)
22+
23+
配置成输出模式后,你还需要使用digitalWrite() 让其输出高电平或者是低电平。
24+
25+
- [x] digitalRead(pin)
26+
27+
读取指定的电平值
28+
29+
### 3 模拟输入/输出
30+
31+
- [x] analogRead(pin)
32+
33+
模拟输入引脚是带有ADC(Analog-to-Digital Converter,模数转换器)功能的引脚。
34+
它可以将外部输入的模拟信号转换为芯片运算时可以识别的数字信号,从而实现读入模拟值的功能。
35+
模拟输入功能需要使用analogRead() 函数。
36+
37+
- [x] analogWrite(pin,value)
38+
39+
使用analogWrite() 函数实现PWM输出功能。
40+
在analogWrite() 和analogRead() 函数内部,已经完成了引脚的初始化,因此不用在Setup() 函数中进行初始化操作。
41+
42+
### 4 高级输入、输出
43+
44+
- [ ] tone()
45+
46+
tone() 主要用于Arduino连接蜂鸣器或扬声器发声。可以让指定引脚产生一个占空比为50%的指定频率的方波。
47+
48+
- [ ] pulseIn()
49+
50+
检测指定引脚上的脉冲信号宽度。
51+
例如当要检测高电平脉冲时,pulseIn() 会等待指定引脚输入的电平变高,当变高后开始记时,直到输入电平变低,停止计时。
52+
pulseln() 函数会返回这个脉冲信号持续的时间,即这个脉冲的宽度。
53+
函数还可以设定超时时间。如果超过设定时间,仍未检测到脉冲,则会退出pulseIn()函数并返回0。
54+
当没有设定超时时间时,pulseIn() 会默认1秒钟的超时时间。
55+
56+
- [ ] attachInterrupt(pin, ISR, mode)
57+
58+
对中断引脚进行初始化配置,以开启Arduino的外部中断功能
59+
60+
- [ ] detachInterrupt(pin)
61+
62+
如果你不需要使用外部中断了,你可以用中断分离函数detachInterrupt() 来关闭中断功能。
63+
64+
### 5 时间控制
65+
66+
- [x] millis()
67+
68+
获取Arduino通电后(或复位后)到现在的时间,单位毫秒ms
69+
70+
- [x] micros()
71+
72+
获取Arduino通电后(或复位后)到现在的时间,单位微秒us
73+
74+
- [x] delay( ms)
75+
76+
毫秒级延时
77+
78+
- [x] micros()
79+
80+
微秒级延时
81+
82+
### 6 串口通信函数
83+
84+
- [x] Serial.begin(speed)
85+
- [x] Serial.print(val)
86+
- [x] Serial.println(val)
87+
- [x] Serial.read()
88+
89+
### 7 I2C通信
90+
91+
### 8 spi通信
92+
93+
94+
95+
## 其他接口
96+
97+
### HardwareSerial
98+
99+
100+
101+
### HardwareTimer
102+
103+
104+
105+
## 构建在核心中的库
106+
107+
### SPI
108+
109+
110+
111+
### I2C
112+
113+
114+
115+
### Servo
116+
117+
118+
119+
### Stepper
120+
121+
122+
123+
### SoftwareSerial
124+
125+
126+
127+
## 其他
128+
129+
130+
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

docs/source/arduino/arduino-1.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 1. 开发环境搭建
2+
3+
本指南将引导您在ArduinoIDE中进行RM通用扩展模块的开发。
4+
5+
在此之前,我们需要安装Arduino开发环境。
6+
7+
![image-20220921162822941](arduino-1.assets/image-20220921162822941.png)
8+
9+
## 1.1 安装Arduino IDE
10+
11+
如果您有安装过ArduinoIDE,请确认版本不低于1.8.12。
12+
13+
如果还未安装,请先下载并安装[ArduinoIDE](https://www.arduino.cc/en/Main/Software)[Windows](https://www.arduino.cc/en/Guide/Windows)[Linux](https://www.arduino.cc/en/Guide/linux)[Mac](https://www.arduino.cc/en/Guide/MacOSX))。
14+
15+
安装好Arduino IDE后,我们需要配置开发板环境,以便实现ArduinoIDE对RM扩展模块开发板的支持。
16+
17+
## 1.2 添加开发板
18+
19+
1 启动ArduinoIDE,单击`文件`,然后单击`首选项`(File->Preferences),打开以下页面。
20+
21+
![arduino0001](arduino-1.assets/arduino0001.PNG)
22+
23+
`附加开发板管理器网址`*Additional Boards Managers URLs*)选项框中添加以下字段:
24+
25+
```
26+
!!!Realse版本需修改
27+
https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
28+
```
29+
30+
2 回到ArduinoIDE中,单击`工具(tools)`,然后选择`开发板(Board)`>`开发板管理器(Boards Manager)`
31+
32+
![arduino0002](arduino-1.assets/arduino0002.PNG)
33+
34+
打开开发板管理器后,等待索引更新完成,向下拉找到`Robomaster Education Module`栏目,单击`安装(Install)`,等待安装完成后,关闭开发板管理器。
35+
36+
![arduino0003](arduino-1.assets/arduino0003.PNG)
37+
38+
再次打开`工具(tools)`->`开发板(Board)`,可以看到刚刚安装好的开发板`RoboMaster Education Series Boards`,选择所需的开发板`RM Expansion Module(RMEM01)`
39+
40+
![arduino0004](arduino-1.assets/arduino0004.PNG)
41+
42+
至此,您已成功安装开发板支持!
43+
44+
## 1.3 创建第一个草图
45+
46+
首先,选中RM扩展模块开发板`RM Expansion Module(RMEM01)`
47+
48+
在下方的端口(Port)处选择开发板对应的端口。
49+
50+
![arduino0005](arduino-1.assets/arduino0005.PNG)
51+
52+
开发板对应端口可以在计算机管理中看到,其名称应该是如`USB串行设备(COMXX)`类似,括号中的`COM10`即为端口号。
53+
54+
![image-20220909174444136](arduino-1.assets/image-20220909174444136.png)
55+
56+
打开Blink示例程序:
57+
58+
点击`文件(File)`->`示例(Examples)`->`01.Basics`->`Blink`,打开新的Blink示例程序。
59+
60+
![arduino0006](arduino-1.assets/arduino0006.PNG)
61+
62+
找到IDE工具栏,从左到右分别是“仅编译”以及“编译+上传”按钮。
63+
64+
![image-20220921163513005](arduino-1.assets/image-20220921163513005.png)
65+
66+
点击第二个按钮,ArduinoIDE会在完成编译工作之后自动将编译之后的二进制文件上传(烧写)到RM扩展模块中。
67+
68+
烧写完成后,RM扩展模块的LED灯会以1s的时间间隔间歇闪烁。
69+

0 commit comments

Comments
 (0)