差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
wm_wiki:25mm_encoder_motor:manual [2020/03/10 16:41] juneral [1. 电机概述] |
wm_wiki:25mm_encoder_motor:manual [2020/05/12 15:43] (当前版本) juneral [3. 编程指南] |
||
---|---|---|---|
行 6: | 行 6: | ||
<p class=MsoNormal style='text-indent:32.0pt'><span lang=EN-US | <p class=MsoNormal style='text-indent:32.0pt'><span lang=EN-US | ||
style='font-size:16.0pt;line-height:105%;font-family:宋体'>25MM</span><span | style='font-size:16.0pt;line-height:105%;font-family:宋体'>25MM</span><span | ||
- | style='font-size:16.0pt;line-height:105%;font-family:宋体'>直流电机顾名思义,即外直径为<span | + | style='font-size:16.0pt;line-height:105%;font-family:宋体'>编码电机是可对其速度、方向、距离等参数进行反馈的电机,可实现机器人的精准运动的需求。</span></p> |
- | lang=EN-US>25</span>毫米的直流电机,是<span lang=EN-US>Weeemake</span>平台一款常用的电机,有各个不同的转速可供选择,适应不同的需求,它能提供比<span | + | |
- | lang=EN-US>TT</span>直流电机更强的动力驱动,其有专用的电机金属固定架,可方便与<span lang=EN-US>Weeemake</span>机械零件组装,扩展性能强。</span></p> | + | |
</body></html> | </body></html> | ||
行 21: | 行 19: | ||
===== 3. 编程指南 ===== | ===== 3. 编程指南 ===== | ||
- | ==== 3.1. 模块功能及图形化编程指南 ==== | ||
<html><body> | <html><body> | ||
- | <p class=MsoNormal style='text-indent:32.0pt'><span style='font-size:16.0pt; | + | <p class=MsoNormal style='text-indent:32.15pt'><b><span style='font-size:16.0pt; |
- | line-height:105%;font-family:等线;color:#666666;background:white'>该电机支持的图形化编程平台有</span></span><span | + | line-height:105%;font-family:宋体;color:#222222;background:white'>请参考编码电机驱动模块编程指南。(<span |
- | lang=EN-US style='font-size:16.0pt;line-height:105%;font-family:"Helvetica",sans-serif; | + | lang=EN-US><a |
- | color:#666666;background:white'><span style='box-sizing: border-box;font-variant-ligatures: normal; | + | href="doku.php?id=wm_wiki:encoder_motor_driver:manual#%E7%BC%96%E7%A8%8B%E6%8C%87%E5%8D%97"><span |
- | font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px; | + | lang=EN-US><span lang=EN-US>传送门</span></span></a></span>)</span></b></p> |
- | text-decoration-style: initial;text-decoration-color: initial;word-spacing: | + | |
- | 0px'>WeeeCode</span></span><span style='font-size:16.0pt;line-height:105%; | + | |
- | font-family:等线;color:#666666;background:white'><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><span | + | |
- | lang=EN-US style='font-size:16.0pt;line-height:105%;font-family:"Helvetica",sans-serif; | + | |
- | color:#666666;background:white'><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'>Mixly_Arduino</span></span><span style='font-size:16.0pt;line-height:105%; | + | |
- | font-family:等线;color:#666666;background:white'><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><span | + | |
- | lang=EN-US style='font-size:16.0pt;line-height:105%;font-family:"Helvetica",sans-serif; | + | |
- | color:#666666;background:white'><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'>MakeCode</span></span><span style='font-size:16.0pt;line-height:105%; | + | |
- | font-family:等线;color:#666666;background:white'><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 style='height:24.7pt'> | + | |
- | <td width=244 valign=top style='width:183.3pt;border:solid windowtext 1.0pt; | + | |
- | padding:0cm 5.4pt 0cm 5.4pt;height:24.7pt'> | + | |
- | <p class=MsoNormal align=center style='margin-bottom:0cm;margin-bottom:.0001pt; | + | |
- | text-align:center;line-height:normal'><b><span style='font-size:14.0pt; | + | |
- | font-family:等线;color:black;background:white'>模块功能</span></b></p> | + | |
- | </td> | + | |
- | <td width=189 valign=top style='width:142.05pt;border:solid windowtext 1.0pt; | + | |
- | border-left:none;padding:0cm 5.4pt 0cm 5.4pt;height:24.7pt'> | + | |
- | <p class=MsoNormal align=center style='margin-bottom:0cm;margin-bottom:.0001pt; | + | |
- | text-align:center;line-height:normal'><b><span style='font-size:14.0pt; | + | |
- | font-family:等线;color:black;background:white'>需传参数</span></b></p> | + | |
- | </td> | + | |
- | <td width=455 valign=top style='width:341.05pt;border:solid windowtext 1.0pt; | + | |
- | border-left:none;padding:0cm 5.4pt 0cm 5.4pt;height:24.7pt'> | + | |
- | <p class=MsoNormal align=center style='margin-bottom:0cm;margin-bottom:.0001pt; | + | |
- | text-align:center;line-height:normal'><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:"Helvetica",sans-serif; | + | |
- | 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:"Helvetica",sans-serif; | + | |
- | color:black;background:white'>)</span></span></b></p> | + | |
- | </td> | + | |
- | </tr> | + | |
- | <tr> | + | |
- | <td width=244 style='width:183.3pt;border:solid windowtext 1.0pt;border-top: | + | |
- | none;padding:0cm 5.4pt 0cm 5.4pt'> | + | |
- | <p class=MsoNormal align=center style='margin-bottom:0cm;margin-bottom:.0001pt; | + | |
- | text-align:center;line-height:normal'><span style='font-size:14.0pt; | + | |
- | font-family:等线;color:black;background:white'>驱动电机运作</span></p> | + | |
- | </td> | + | |
- | <td width=189 style='width:142.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 style='margin-bottom:0cm;margin-bottom:.0001pt;line-height: | + | |
- | normal'><span style='font-size:14.0pt;font-family:等线;color:black;background: | + | |
- | white'>(</span><span lang=EN-US style='font-size:14.0pt;font-family:"Helvetica",sans-serif; | + | |
- | color:black;background:white'><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'>2</span></span><span style='font-size:14.0pt;font-family:等线;color:black; | + | |
- | background:white'>个参数)所接端口</span><span style='font-size:14.0pt;font-family: | + | |
- | 宋体;color:black;background:white'>、速度<span lang=EN-US>(-255~255)</span></span></p> | + | |
- | </td> | + | |
- | <td width=455 valign=top style='width:341.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='margin-bottom:0cm;margin-bottom:.0001pt; | + | |
- | text-align:center;line-height:normal'><span lang=EN-US><img width=328 | + | |
- | height=64 id="图片 1" src="https://www.weeemake.com.cn/wiki/lib/exe/fetch.php?media=wm_wiki:tt_dc_motor:pasted:20200310-150145.png"></span></p> | + | |
- | </td> | + | |
- | </tr> | + | |
- | </table> | + | |
- | + | ||
- | </div> | + | |
- | + | ||
- | <p class=MsoNormal style='text-indent:36.0pt'><b><span lang=EN-US | + | |
- | style='font-size:5.0pt;line-height:105%;font-family:等线;color:#ffffff; | + | |
- | background:yellow'><o:p> </o:p></span></b></p> | + | |
- | + | ||
- | <p class=MsoNormal style='text-indent:36.0pt'><b><span style='font-size:16.0pt; | + | |
- | line-height:105%;font-family:等线;color:#666666;background:yellow'>备注:</span></b><span | + | |
- | style='font-size:16.0pt;line-height:105%;font-family:黑体;color:#666666; | + | |
- | background:white'>电机转速正负定义,电机轴面向人,速度值为正:顺时针转;速度值为负:逆时针转</span></p> | + | |
- | + | ||
- | <p class=MsoNormal style='text-indent:36.0pt'><b><span lang=EN-US | + | |
- | style='font-size:5.0pt;line-height:105%;font-family:等线;color:#ffffff; | + | |
- | background:yellow'><o:p> </o:p></span></b></p> | + | |
- | + | ||
- | + | ||
- | <p class=MsoNormal style='text-indent:36.0pt'><span style='font-size:16.0pt; | + | |
- | line-height:105%;font-family:等线;color:#666666;background:white'>图形化编程示例:</span></span></p> | + | |
</body></html> | </body></html> | ||
- | {{ :wm_wiki:tt_dc_motor:pasted:20200310-150534.png }} | ||
- | ==== 3.2. 文本代码编程指南 ==== | ||
- | |||
- | <html><body> | ||
- | <p class=MsoNormal style='text-indent:32.0pt'><span style='font-size:16.0pt; | ||
- | font-family:等线'>Arduino编程示例:</span></p> | ||
- | </body></html> | ||
- | |||
- | <sxh cpp; first-line: 1;highlight: [3,4,13,14,16,17,19,20,22,23]; title: we_dcmotor_test.ino> | ||
- | |||
- | #include "WeELF328P.h" | ||
- | |||
- | WeDCMotor motor1(M1); | ||
- | WeDCMotor motor2(M2); | ||
- | |||
- | uint8_t motorSpeed = 100; | ||
- | void setup() | ||
- | { | ||
- | } | ||
- | void loop() | ||
- | { | ||
- | motor1.run(motorSpeed); | ||
- | motor2.run(motorSpeed); | ||
- | delay(2000); | ||
- | motor1.stop(); | ||
- | motor2.stop(); | ||
- | delay(500); | ||
- | motor1.run(-motorSpeed); | ||
- | motor2.run(-motorSpeed); | ||
- | delay(2000); | ||
- | motor1.stop(); | ||
- | motor2.stop(); | ||
- | delay(500); | ||
- | } | ||
- | </sxh> | ||
===== 4. 注意事项 ===== | ===== 4. 注意事项 ===== | ||