差别

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

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
wm_wiki:tilt_switch_sensor:manual [2020/02/19 16:20]
juneral [3.2. 文本代码编程指南]
wm_wiki:tilt_switch_sensor:manual [2020/05/12 15:20] (当前版本)
juneral [3.1. 模块功能及图形化编程指南]
行 256: 行 256:
   font-variant-ligatures:​ normal;​font-variant-caps:​ normal;​orphans:​ 2;   font-variant-ligatures:​ normal;​font-variant-caps:​ normal;​orphans:​ 2;
   widows: 2;​-webkit-text-stroke-width:​ 0px;​text-decoration-style:​ initial;   widows: 2;​-webkit-text-stroke-width:​ 0px;​text-decoration-style:​ initial;
-  text-decoration-color:​ initial;​word-spacing:​0px'>​个参数)端口、需要获取</​span></​span></​span></​p>​+  text-decoration-color:​ initial;​word-spacing:​0px'>​个参数)端口、需要判断状态</​span></​span></​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:​
行 263: 行 263:
   <p class=MsoNormal align=center style='​text-align:​center'><​span   <p class=MsoNormal align=center style='​text-align:​center'><​span
   style='​color:​windowtext'><​img width=407 height=136 id="​图片 2"   style='​color:​windowtext'><​img width=407 height=136 id="​图片 2"
-  src="https://​www.weeemake.com.cn/​wiki/​lib/​exe/​fetch.php?​media=wm_wiki:​tilt_switch_sensor:​pasted:​20190516-163330.png"></​span></​p>​+  src="​lib/​exe/​fetch.php?​media=wm_wiki:​tilt_switch_sensor:​pasted:​20200220-144052.png"></​span></​p>​
   </td>   </td>
  </​tr>​  </​tr>​
行 271: 行 271:
 <p class=MsoNormal style='​text-indent:​21.0pt'><​span style='​font-size:​16.0pt;​ <p class=MsoNormal style='​text-indent:​21.0pt'><​span style='​font-size:​16.0pt;​
 font-family:​华文楷体'>&​nbsp;</​span><​span lang=ZH-CN style='​font-size:​16.0pt;​ font-family:​华文楷体'>&​nbsp;</​span><​span lang=ZH-CN style='​font-size:​16.0pt;​
-font-family:​宋体'>​编程示例:</​span></​p>​ +font-family:​宋体'>​图形化编程示例:</​span></​p>​
-<p class=MsoNormal align=center style='​text-align:​center;​text-indent:​21.0pt'><​span +
-style='​mso-no-proof:​yes'><​img width=361 height=518 id="​_x0000_i1025"​ +
-src="​https://​www.weeemake.com.cn/​wiki/​lib/​exe/​fetch.php?​media=wm_wiki:​tilt_switch_sensor:​pasted:​20190516-202135.png"​ +
-alt="​https://​www.weeemake.com.cn/​wiki/​lib/​exe/​fetch.php?​media=wm_wiki:​tilt_switch_sensor:​pasted:​20190516-202135.png">​</​span></​p>​+
 </​body></​html>​ </​body></​html>​
 +
 +{{ :​wm_wiki:​tilt_switch_sensor:​pasted:​20200219-163015.png }}
  
 ==== 3.2. 文本代码编程指南 ==== ==== 3.2. 文本代码编程指南 ====
  
 <​html><​body>​ <​html><​body>​
 +<p class=MsoNormal style='​text-indent:​21.0pt'><​span style='​font-size:​16.0pt;​
 +font-family:​华文楷体'>&​nbsp;</​span><​span lang=ZH-CN style='​font-size:​16.0pt;​
 +font-family:​宋体'>​Arduino编程示例:</​span></​p>​
  
 +</​body></​html>​
 +
 +<sxh cpp; first-line: 1;​highlight:​ [3,14]; title: TiltSwitch_sensor_test.ino>​
 +
 +#​include<​WeELF328P.h>​
 +
 +WeTiltSwitch tilt_D(PORT_D);​
 +
 +WeRGBLed rgb_led_board(OnBoard_RGB);​
 +
 +uint8_t tilt_D_value;​
 +
 +void setup(){
 + delay(1000);​
 +}
 +
 +void loop(){
 + tilt_D_value = tilt_D.readSensor();​
 + if(tilt_D_value == 2){
 + rgb_led_board.setColor(1,​ 20, 0, 0);
 + rgb_led_board.show();​
 + }else if(tilt_D_value == 1){
 + rgb_led_board.setColor(1,​ 0, 0, 20);
 + rgb_led_board.show();​
 + }else{
 + rgb_led_board.setColor(1,​ 0, 0, 0);
 + rgb_led_board.show();​
 + }
 + delay(100);​
 +}
 +  ​
 +</​sxh>​
 +
 +\\
 +<​html><​body>​
 +<p class=MsoNormal style='​text-indent:​21.0pt'><​span style='​font-size:​16.0pt;​
 +font-family:​华文楷体'>&​nbsp;</​span><​span lang=ZH-CN style='​font-size:​16.0pt;​
 +font-family:​宋体'>​更多使用实例请前往论坛学习:倾斜开关使用示例</​span></​p>​
  
 </​body></​html>​ </​body></​html>​