差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
wm_wiki:adapter_module:manual [2020/03/12 15:52] juneral [2. 参数规格] |
wm_wiki:adapter_module:manual [2020/03/12 16:11] (当前版本) juneral [1. 简要概述] |
||
---|---|---|---|
行 6: | 行 6: | ||
16.0pt;font-family:宋体'>模块是一个转接适配模块,用于适配<span lang=EN-US>ELF</span>主控板接舵机、<span | 16.0pt;font-family:宋体'>模块是一个转接适配模块,用于适配<span lang=EN-US>ELF</span>主控板接舵机、<span | ||
lang=EN-US>RGB</span>灯条、<span lang=EN-US>DS18B20</span>温度棒、土壤湿度传感器等。</span></p> | lang=EN-US>RGB</span>灯条、<span lang=EN-US>DS18B20</span>温度棒、土壤湿度传感器等。</span></p> | ||
+ | |||
+ | <p class=MsoNormal style='text-indent:32.0pt'><span style='font-size:16.0pt; | ||
+ | font-family:宋体'>模块外观:</span></p> | ||
</body></html> | </body></html> | ||
+ | |||
+ | {{ :wm_wiki:adapter_module:pasted:20200312-161105.png }} | ||
===== 2. 参数规格 ===== | ===== 2. 参数规格 ===== | ||
<html><body> | <html><body> | ||
行 90: | 行 95: | ||
</body></html> | </body></html> | ||
- | ===== 3. 功能特性 ===== | ||
- | <html><body> | ||
- | <p class=MsoListParagraph style='margin-left:42.0pt;text-indent:-21.0pt'><span | ||
- | lang=EN-US style='font-size:16.0pt;font-family:Wingdings'>l<span | ||
- | style='font:7.0pt "Times New Roman"'>  </span></span><span | ||
- | style='font-size:16.0pt'>准确的控制编码电机的位置</span></p> | ||
- | <p class=MsoListParagraph style='margin-left:42.0pt;text-indent:-21.0pt'><span | + | ===== 3. 连接方式 ===== |
- | lang=EN-US style='font-size:16.0pt;font-family:Wingdings'>l<span | + | |
- | style='font:7.0pt "Times New Roman"'>  </span></span><span | + | |
- | style='font-size:16.0pt'>提供实时的位置和速度反馈</span></p> | + | |
- | + | ||
- | <p class=MsoListParagraph style='margin-left:42.0pt;text-indent:-21.0pt'><span | + | |
- | lang=EN-US style='font-size:16.0pt;font-family:Wingdings'>l<span | + | |
- | style='font:7.0pt "Times New Roman"'>  </span></span><span | + | |
- | style='font-size:16.0pt'>采用排针排母组合方式,防止反接</span></p> | + | |
- | + | ||
- | <p class=MsoListParagraph style='margin-left:42.0pt;text-indent:-21.0pt'><span | + | |
- | lang=EN-US style='font-size:16.0pt;font-family:Wingdings'>l<span | + | |
- | style='font:7.0pt "Times New Roman"'>  </span></span><span | + | |
- | style='font-size:16.0pt'>模块体积小巧,接插方便</span></p> | + | |
- | </body></html> | + | |
- | + | ||
- | ===== 4. 连接方式 ===== | + | |
<html><body> | <html><body> | ||
- | <p class=MsoNormal style='text-indent:32.0pt'><span style='font-size:16.0pt'>本模块目前只能用于<span | ||
- | lang=EN-US>ELF</span>主控板上,可以接插在<span lang=EN-US>ELF</span>主控板上的<span | ||
- | lang=EN-US>port3-port6</span>共<span lang=EN-US>4</span>个口上,以及<span lang=EN-US>2560</span>比赛扩展板的<span | ||
- | lang=EN-US>port7-port9</span>共<span lang=EN-US>3</span>个口上。</span></p> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><img | ||
- | width=393 height=168 | ||
- | src="https://www.weeemake.com.cn/wiki/lib/exe/fetch.php?media=wm_wiki:compass_sensor:pasted:20190511-16132.png"></span></p> | ||
- | |||
- | <p class=MsoNormal style='text-indent:32.0pt'><span style='font-size:16.0pt'>直流电机是接插在<span | ||
- | lang=EN-US>ELF</span>主控板的橘红色端子上,编码电机是接插在驱动模块的白色端子上。编码电机和直流电机不可同时插上,这样会造成电流过大且不好控制的问题。</span></p> | ||
- | |||
- | <p class=MsoTitle><span lang=EN-US> </span></p> | ||
</body></html> | </body></html> | ||
- | ===== 5. 编程指南 ===== | ||
- | ==== 5.1. 模块功能及图形化编程指南 ==== | ||
- | <html><body> | ||
- | <p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US | ||
- | style='font-size:16.0pt;font-family:华文楷体;color:#222222;background:white'>    | ||
- | </span><span style='font-size:16.0pt;font-family:宋体;color:#222222;background: | ||
- | white'>该模块支持的图形化编程平台有<span lang=EN-US><span style='box-sizing: border-box; | ||
- | font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: | ||
- | start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial; | ||
- | text-decoration-color: initial;word-spacing:0px'>WeeeCode</span></span><span | ||
- | style='box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal; | ||
- | orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px; | ||
- | text-decoration-style: initial;text-decoration-color: initial;word-spacing: | ||
- | 0px'>、<span lang=EN-US>Mixly_Arduino</span></span><span style='box-sizing: border-box; | ||
- | font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: | ||
- | start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial; | ||
- | text-decoration-color: initial;word-spacing:0px'>等,其图形化编程大同小异,区别不会很大。</span></span></p> | ||
- | <div align=center> | ||
- | <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 | ||
- | style='border-collapse:collapse'> | ||
- | <tr> | ||
- | <td width=257 valign=top style='width:192.65pt;border:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><b><span | ||
- | style='font-size:14.0pt;font-family:华文楷体;color:black;background:white'>模块功能</span></b></p> | ||
- | </td> | ||
- | <td width=223 valign=top style='width:166.95pt;border:solid windowtext 1.0pt; | ||
- | border-left:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><b><span | ||
- | style='font-size:14.0pt;font-family:华文楷体;color:black;background:white'>需传参数</span></b></p> | ||
- | </td> | ||
- | <td width=462 valign=top style='width:346.5pt;border:solid windowtext 1.0pt; | ||
- | border-left:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><b><span | ||
- | style='font-size:14.0pt;font-family:华文楷体;color:black;background:white'>图形化编程块举例</span></b><b | ||
- | style='box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal; | ||
- | orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial; | ||
- | text-decoration-color: initial;word-spacing:0px'><span style='box-sizing: border-box'><span | ||
- | lang=EN-US style='font-size:14.0pt;font-family:华文楷体;color:black;background: | ||
- | white'>(</span></span></b><b style='box-sizing: border-box;font-variant-ligatures: normal; | ||
- | font-variant-caps: normal;orphans: 2;widows: 2;-webkit-text-stroke-width: 0px; | ||
- | text-decoration-style: initial;text-decoration-color: initial;word-spacing: | ||
- | 0px'><span style='box-sizing: border-box'><span style='font-size:14.0pt; | ||
- | font-family:华文楷体;color:black;background:white'>其他平台图形化编程块大同小异</span></span></b><b | ||
- | style='box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal; | ||
- | orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial; | ||
- | text-decoration-color: initial;word-spacing:0px'><span style='box-sizing: border-box'><span | ||
- | lang=EN-US style='font-size:14.0pt;font-family:华文楷体;color:black;background: | ||
- | white'>)</span></span></b></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=257 style='width:192.65pt;border:solid windowtext 1.0pt;border-top: | ||
- | none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal><span style='font-size:14.0pt;font-family:华文楷体;color:black; | ||
- | background:white'>设置<span lang=EN-US>0</span>点</span></p> | ||
- | </td> | ||
- | <td width=223 style='width:166.95pt;border-top:none;border-left:none; | ||
- | border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal><span lang=EN-US style='font-size:14.0pt;font-family:华文楷体; | ||
- | color:black;background:white'>(1</span><span style='font-size:14.0pt; | ||
- | font-family:华文楷体;color:black;background:white'>个参数)端口</span></p> | ||
- | </td> | ||
- | <td width=462 valign=top style='width:346.5pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><img | ||
- | width=365 height=183 id="图片 7" src="https://www.weeemake.com.cn/wiki/lib/exe/fetch.php?media=wm_wiki:encoder_motor_driver:pasted:20200221-151728.png"></span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=257 style='width:192.65pt;border:solid windowtext 1.0pt;border-top: | ||
- | none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal><span style='font-size:14.0pt;font-family:华文楷体;color:black; | ||
- | background:white'>以某速度运行(不检测速度)</span></span></p> | ||
- | </td> | ||
- | <td width=223 style='width:166.95pt;border-top:none;border-left:none; | ||
- | border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal><span lang=EN-US style='font-size:14.0pt;font-family:华文楷体; | ||
- | color:black;background:white'>(2</span><span style='font-size:14.0pt; | ||
- | font-family:华文楷体;color:black;background:white'>个参数)端口、速度</span></p> | ||
- | </td> | ||
- | <td width=462 valign=top style='width:346.5pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><img | ||
- | width=409 height=185 id="图片 4" src="https://www.weeemake.com.cn/wiki/lib/exe/fetch.php?media=wm_wiki:encoder_motor_driver:pasted:20200221-151926.png"></span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=257 style='width:192.65pt;border:solid windowtext 1.0pt;border-top: | ||
- | none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal><span style='font-size:14.0pt;font-family:华文楷体;color:black; | ||
- | background:white'>以某速度运行(检测速度),注:这个速度是</span><span lang=EN-US><span | ||
- | style='box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal; | ||
- | orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial; | ||
- | text-decoration-color: initial;word-spacing:0px'>50ms</span></span><span | ||
- | style='box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal; | ||
- | orphans: 2;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial; | ||
- | text-decoration-color: initial;word-spacing:0px'>的脉冲数</span></span></p> | ||
- | </td> | ||
- | <td width=223 style='width:166.95pt;border-top:none;border-left:none; | ||
- | border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal><span lang=EN-US style='font-size:14.0pt;font-family:华文楷体; | ||
- | color:black;background:white'>(2</span><span style='font-size:14.0pt; | ||
- | font-family:华文楷体;color:black;background:white'>个参数)端口、速度</span></p> | ||
- | </td> | ||
- | <td width=462 valign=top style='width:346.5pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><img | ||
- | width=482 height=190 id="图片 5" src="https://www.weeemake.com.cn/wiki/lib/exe/fetch.php?media=wm_wiki:encoder_motor_driver:pasted:20200221-152059.png"></span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=257 style='width:192.65pt;border:solid windowtext 1.0pt;border-top: | ||
- | none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal><span style='font-size:14.0pt;font-family:华文楷体;color:black; | ||
- | background:white'>以某速度在移动某位置(相对位置)</span></span></p> | ||
- | </td> | ||
- | <td width=223 style='width:166.95pt;border-top:none;border-left:none; | ||
- | border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal><span lang=EN-US style='font-size:14.0pt;font-family:华文楷体; | ||
- | color:black;background:white'>(2</span><span style='font-size:14.0pt; | ||
- | font-family:华文楷体;color:black;background:white'>个参数)端口、移动量</span></p> | ||
- | </td> | ||
- | <td width=462 valign=top style='width:346.5pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><img | ||
- | width=342 height=191 id="图片 6" src="https://www.weeemake.com.cn/wiki/lib/exe/fetch.php?media=wm_wiki:encoder_motor_driver:pasted:20200221-152107.png"></span></p> | ||
- | </td> | ||
- | </tr> | ||
- | </table> | ||
- | </div> | ||
- | <p class=MsoNormal style='text-indent:21.0pt'><span lang=EN-US | ||
- | style='font-size:16.0pt;font-family:华文楷体;color:white'> </span></p> | ||
- | <p class=MsoTitle style='text-indent:31.0pt'><span style='font-size:16.0pt; | ||
- | font-family:等线'>图形化编程示例:</span></p> | ||
- | </body></html> | ||
- | |||
- | {{ :wm_wiki:encoder_motor_driver:pasted:20200221-153031.png }} | ||
- | ==== 5.2. 文本代码编程指南 ==== | ||
- | <html><body> | ||
- | <p class=MsoTitle style='text-indent:31.0pt'><span lang=EN-US style='font-size: | ||
- | 16.0pt;font-family:等线'>Arduino</span><span style='font-size:16.0pt;font-family: | ||
- | 等线'>编程函数:</span></p> | ||
- | |||
- | <div align=center> | ||
- | |||
- | <table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 | ||
- | style='border-collapse:collapse;border:none'> | ||
- | <tr> | ||
- | <td width=344 valign=top style='width:257.8pt;border:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>函数名</span></p> | ||
- | </td> | ||
- | <td width=544 valign=top style='width:408.05pt;border:solid windowtext 1.0pt; | ||
- | border-left:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>功能</span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=344 valign=top style='width:257.8pt;border:solid windowtext 1.0pt; | ||
- | border-top:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US | ||
- | style='font-size:14.0pt;font-family:"Calibri",sans-serif'>WeEncoderMotor(uint8_t | ||
- | port)</span></p> | ||
- | </td> | ||
- | <td width=544 valign=top style='width:408.05pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>设置端口号</span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=344 valign=top style='width:257.8pt;border:solid windowtext 1.0pt; | ||
- | border-top:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US | ||
- | style='font-size:14.0pt;font-family:"Calibri",sans-serif'>run(int16_t speed)</span></p> | ||
- | </td> | ||
- | <td width=544 valign=top style='width:408.05pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>以某速度运行(不检测速度)</span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=344 valign=top style='width:257.8pt;border:solid windowtext 1.0pt; | ||
- | border-top:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US | ||
- | style='font-size:14.0pt;font-family:"Calibri",sans-serif'>getCurrentPosition(void)</span></p> | ||
- | </td> | ||
- | <td width=544 valign=top style='width:408.05pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>获取当前的位置</span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=344 valign=top style='width:257.8pt;border:solid windowtext 1.0pt; | ||
- | border-top:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US | ||
- | style='font-size:14.0pt;font-family:"Calibri",sans-serif'>setPositionOrigin(void)</span></p> | ||
- | </td> | ||
- | <td width=544 valign=top style='width:408.05pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>设置</span><span lang=EN-US style='font-size:14.0pt; | ||
- | font-family:"Calibri",sans-serif'>0</span><span style='font-size:14.0pt'>点</span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=344 valign=top style='width:257.8pt;border:solid windowtext 1.0pt; | ||
- | border-top:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US | ||
- | style='font-size:14.0pt;font-family:"Calibri",sans-serif'>stop(void)</span></p> | ||
- | </td> | ||
- | <td width=544 valign=top style='width:408.05pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>停止</span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=344 valign=top style='width:257.8pt;border:solid windowtext 1.0pt; | ||
- | border-top:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US | ||
- | style='font-size:14.0pt;font-family:"Calibri",sans-serif'>moveTo(uint8_t | ||
- | speed,long position)</span></p> | ||
- | </td> | ||
- | <td width=544 valign=top style='width:408.05pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>以某速度移动到某位置(绝对位置)</span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=344 valign=top style='width:257.8pt;border:solid windowtext 1.0pt; | ||
- | border-top:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US | ||
- | style='font-size:14.0pt;font-family:"Calibri",sans-serif'>move(uint8_t | ||
- | speed,long position)</span></p> | ||
- | </td> | ||
- | <td width=544 valign=top style='width:408.05pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>以某速度在移动某位置(相对位置)</span></p> | ||
- | </td> | ||
- | </tr> | ||
- | <tr> | ||
- | <td width=344 valign=top style='width:257.8pt;border:solid windowtext 1.0pt; | ||
- | border-top:none;padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US | ||
- | style='font-size:14.0pt;font-family:"Calibri",sans-serif'>runSpeed(int16_t | ||
- | speed)</span></p> | ||
- | </td> | ||
- | <td width=544 valign=top style='width:408.05pt;border-top:none;border-left: | ||
- | none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt; | ||
- | padding:0cm 5.4pt 0cm 5.4pt'> | ||
- | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt'>以某速度运行(检测速度),注:这个速度是</span><span lang=EN-US | ||
- | style='font-size:14.0pt;font-family:"Calibri",sans-serif'>50ms</span><span | ||
- | style='font-size:14.0pt'>的脉冲数</span></p> | ||
- | </td> | ||
- | </tr> | ||
- | </table> | ||
- | |||
- | </div> | ||
- | |||
- | <p class=MsoTitle style='text-indent:31.0pt'><span lang=EN-US style='font-size: | ||
- | 16.0pt;font-family:等线'> </span></p> | ||
- | |||
- | <p class=MsoTitle style='text-indent:31.0pt'><span lang=EN-US style='font-size: | ||
- | 16.0pt;font-family:等线'>Arduino</span><span style='font-size:16.0pt;font-family: | ||
- | 等线'>编程示例:</span></p> | ||
- | </body></html> | ||
- | |||
- | <sxh cpp; first-line: 1;highlight: [89,92]; title: encoder_motor_test.ino> | ||
- | |||
- | #include "WeELF328P.h" | ||
- | WeEncoderMotor motor1(PORT_3); | ||
- | |||
- | uint8_t motorSpeed = 100; | ||
- | void setup() | ||
- | { | ||
- | Serial.begin(9600); | ||
- | delay(2000); | ||
- | motor1.setPositionOrigin(); | ||
- | } | ||
- | |||
- | void loop() | ||
- | { | ||
- | Serial.println(motor1.getCurrentPosition()); | ||
- | motor1.moveTo(motorSpeed,585); | ||
- | delay(3000); | ||
- | | ||
- | Serial.println(motor1.getCurrentPosition()); | ||
- | motor1.moveTo(motorSpeed,1); | ||
- | delay(3000); | ||
- | } | ||
- | </sxh> | ||
- | ===== 6. 注意事项 ===== | ||
- | <html><body> | ||
- | <p class=MsoNormal style='text-indent:36.0pt'><span style='font-size:16.0pt'>和使用电机一样,不能长时间快速正反转,这样会造成电流过大,发热量大,烧毁模块上的驱动芯片。</span></p> | ||
- | |||
- | </body></html> |