差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
wm_wiki:switch_module:manual [2020/03/13 15:12] juneral [2. 参数规格] |
wm_wiki:switch_module:manual [2020/05/12 15:36] (当前版本) juneral [3.1. 模块功能及图形化编程指南] |
||
---|---|---|---|
行 5: | 行 5: | ||
<p class=MsoTitle align=left style='text-align:left;text-indent:36.0pt'><span | <p class=MsoTitle align=left style='text-align:left;text-indent:36.0pt'><span | ||
style='font-size:16.0pt;font-family:宋体;color:#222222;letter-spacing:0pt; | style='font-size:16.0pt;font-family:宋体;color:#222222;letter-spacing:0pt; | ||
- | background:white'>限位开关模块是一款物理开关,与机械结构结合使用,起限位作用,当触发时,它会输出一个电平信号给控制端。</span></p> | + | background:white'>限位开关模块是一款物理开关,与机械结构结合使用,可起限位作用,当触发时,它会输出一个电平信号给控制端。</span></p> |
+ | <p class=MsoTitle align=left style='text-align:left;text-indent:36.0pt'><span | ||
+ | style='font-size:16.0pt;font-family:宋体;color:#222222;letter-spacing:0pt; | ||
+ | background:white'>模块外观:</span></p> | ||
</body></html> | </body></html> | ||
+ | |||
+ | {{ :wm_wiki:switch_module:pasted:20200313-152430.png }} | ||
===== 2. 参数规格 ===== | ===== 2. 参数规格 ===== | ||
<html><body> | <html><body> | ||
行 134: | 行 139: | ||
===== 3. 编程指南 ===== | ===== 3. 编程指南 ===== | ||
+ | |||
行 168: | 行 174: | ||
none;padding:0cm 5.4pt 0cm 5.4pt;height:12.95pt'> | none;padding:0cm 5.4pt 0cm 5.4pt;height:12.95pt'> | ||
<p class=MsoNormal align=center style='text-align:center'><span | <p class=MsoNormal align=center style='text-align:center'><span | ||
- | style='font-size:14.0pt;font-family:华文楷体;color:black;background:white'>驱动<span | + | style='font-size:14.0pt;font-family:华文楷体;color:black;background:white'>输出开关信号</span></p> |
- | lang=EN-US>LED</span>亮灭</span></p> | + | |
</td> | </td> | ||
<td width=223 style='width:166.95pt;border-top:none;border-left:none; | <td width=223 style='width:166.95pt;border-top:none;border-left:none; | ||
行 175: | 行 180: | ||
padding:0cm 5.4pt 0cm 5.4pt;height:12.95pt'> | padding:0cm 5.4pt 0cm 5.4pt;height:12.95pt'> | ||
<p class=MsoNormal align=center style='text-align:center'><span lang=EN-US | <p class=MsoNormal align=center style='text-align:center'><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'>(1</span><span |
- | style='font-size:14.0pt;font-family:华文楷体;color:black;background:white'>个参数)端口、灯的亮灭</span></p> | + | style='font-size:14.0pt;font-family:华文楷体;color:black;background:white'>个参数)端口</span></p> |
</td> | </td> | ||
<td width=462 valign=top style='width:346.5pt;border-top:none;border-left: | <td width=462 valign=top style='width:346.5pt;border-top:none;border-left: | ||
行 182: | 行 187: | ||
padding:0cm 5.4pt 0cm 5.4pt;height:12.95pt'> | padding:0cm 5.4pt 0cm 5.4pt;height:12.95pt'> | ||
<p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><img | <p class=MsoNormal align=center style='text-align:center'><span lang=EN-US><img | ||
- | width=353 height=131 id="图片 1" src="https://www.weeemake.com.cn/wiki/lib/exe/fetch.php?media=wm_wiki:single_led_module:pasted:20200312-191746.png"></span></p> | + | width=246 height=51 id="图片 1" src="lib/exe/fetch.php?media=wm_wiki:switch_module:pasted:20200313-151320.png"></span></p> |
</td> | </td> | ||
</tr> | </tr> | ||
行 197: | 行 202: | ||
</body></html> | </body></html> | ||
- | {{ :wm_wiki:single_led_module:pasted:20200312-191612.png }} | + | {{ :wm_wiki:switch_module:pasted:20200313-151306.png }} |
==== 3.2. 文本代码编程指南 ==== | ==== 3.2. 文本代码编程指南 ==== | ||
<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.0pt'><span style='font-size:16.0pt; | ||
- | font-family:宋体;color:#222222;background:white'>图形化编程示例:</span></p> | + | font-family:宋体;color:#222222;background:white'>Arduino编程示例:</span></p> |
</body></html> | </body></html> | ||
- | <sxh cpp; first-line: 1;highlight: [4,8,10]; title: single_led_test.ino> | + | <sxh cpp; first-line: 1;highlight: [2,9]; title: switch_module_test.ino> |
- | #include<WeELF328P.h> | + | #include "WeELF328P.h" |
- | + | WeLimitSwitch limitSwitch(PORT_A); | |
- | void setup(){ | + | void setup() |
- | pinMode(PORT_D, OUTPUT); | + | { |
+ | Serial.begin(9600); | ||
} | } | ||
- | + | void loop() | |
- | void loop(){ | + | { |
- | digitalWrite(PORT_D, 1); | + | if(limitSwitch.read()==1) |
- | delay(1000); | + | { |
- | digitalWrite(PORT_D, 0); | + | Serial.println("limitSwitch DOWN"); |
- | delay(1000); | + | } |
+ | delay(100); | ||
} | } | ||
</sxh> | </sxh> |