差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
wm_wiki:tt_dc_motor:manual [2020/03/10 15:02]
juneral [3.1. 模块功能及图形化编程指南]
wm_wiki:tt_dc_motor:manual [2020/05/12 15:43] (当前版本)
juneral [3.1. 模块功能及图形化编程指南]
行 10: 行 10:
 </​body></​html>​ </​body></​html>​
  
 +{{ :​wm_wiki:​tt_dc_motor:​pasted:​20200310-151819.png }}
 ===== 2. 电机参数 ===== ===== 2. 电机参数 =====
 <​html><​body>​ <​html><​body>​
行 245: 行 246:
   background:​white'>​个参数)所接端口</​span><​span style='​font-size:​14.0pt;​font-family:​   background:​white'>​个参数)所接端口</​span><​span style='​font-size:​14.0pt;​font-family:​
   宋体;​color:​black;​background:​white'>​、速度<​span lang=EN-US>​(-255~255)</​span></​span></​p>​   宋体;​color:​black;​background:​white'>​、速度<​span lang=EN-US>​(-255~255)</​span></​span></​p>​
-  <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></​p>​ 
-  <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></​p>​ 
   </td>   </td>
   <td width=455 valign=top style='​width:​341.05pt;​border-top:​none;​border-left:​   <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;   none;​border-bottom:​solid windowtext 1.0pt;​border-right:​solid windowtext 1.0pt;
   padding:0cm 5.4pt 0cm 5.4pt'>​   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>&​nbsp;</​span></​p>​ 
   <p class=MsoNormal align=center style='​margin-bottom:​0cm;​margin-bottom:​.0001pt;​   <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   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>​+  height=64 id="​图片 1" src="​lib/​exe/​fetch.php?​media=wm_wiki:​tt_dc_motor:​pasted:​20200310-150145.png"></​span></​p>​
   </td>   </td>
  </​tr>​  </​tr>​
行 266: 行 259:
 </​div>​ </​div>​
  
-<p class=MsoNormal style='​text-indent:​36.0pt'><​span lang=EN-US>&​nbsp;</​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>&​nbsp;​</​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>&​nbsp;</​o:​p></​span></​b></​p>​ 
  
 <p class=MsoNormal style='​text-indent:​36.0pt'><​span style='​font-size:​16.0pt;​ <p class=MsoNormal style='​text-indent:​36.0pt'><​span style='​font-size:​16.0pt;​
行 273: 行 278:
 </​body></​html>​ </​body></​html>​
  
 +{{ :​wm_wiki:​tt_dc_motor:​pasted:​20200310-150534.png }}
 ==== 3.2. 文本代码编程指南 ==== ==== 3.2. 文本代码编程指南 ====
  
行 280: 行 286:
 </​body></​html>​ </​body></​html>​
  
-<sxh cpp; first-line: 1;​highlight:​ [3,14,17]; title: ​we_130dcmotor_test.ino>+<sxh cpp; first-line: 1;​highlight:​ [3,4,13,14,16,17,​19,​20,​22,​23]; title: ​we_dcmotor_test.ino>
  
 #include "​WeELF328P.h"​ #include "​WeELF328P.h"​
  
-We130DCMotor motor(PORT_A);+WeDCMotor motor1(M1); 
 +WeDCMotor motor2(M2);
  
-int motorSpeed = 0;+uint8_t ​motorSpeed = 100;
  
 void setup() void setup()
行 292: 行 299:
 } }
 void loop() ​ void loop() ​
-{  +
-  ​for(motorSpeed=50;motorSpeed<255;motorSpeed+++  ​motor1.run(motorSpeed); 
-  ​{ +  motor2.run(motorSpeed); 
-      motor.run(motorSpeed);​ +  delay(2000); 
-      delay(100); +  ​motor1.stop();​ 
-  ​} +  ​motor2.stop();​ 
-  ​motor.stop(); +  delay(500);​ 
-  delay(1000);+  motor1.run(-motorSpeed);​ 
 +  ​motor2.run(-motorSpeed);​ 
 +  ​delay(2000); 
 +  ​motor1.stop();​ 
 +  ​motor2.stop(); 
 +  delay(500);
 } }
 </​sxh>​ </​sxh>​