“排风扇”的版本间的差异

来自Labplus盛思维基百科
跳转至: 导航搜索
Arduino示例
第45行: 第45行:
 
}
 
}
 
</pre>
 
</pre>
 +
== 版本历史记录 ==
 +
 +
{|  border="1" cellspacing="0" align="left" cellpadding="0" width="60%" style="text-align:center;"
 +
|- style="text-align:center;background-color:#6fa8dc;color:#fffff;"
 +
!width="10%"|Version !!width="15%"| Date !! Note  <small>[+]新增[-]删除[^]修复</small>
 +
|-
 +
| V2.0 || || style="text-align:left"|
 +
|}

2018年3月28日 (三) 14:16的版本

黑色传感器最终版12.20-20.png

概述

通过IO引脚输出高低电平控制风扇转动。高电平转动,低电平则否。

技术参数

  • 工作电压:VCC 3.3-5V
  • 模块尺寸:24x46x7.5mm

引脚定义

VCC 电源
NC 空脚
DI 数字输入(高低电平控制风扇)
GND

使用教程

Arduino示例

//程序功能:按键按下,风扇转动;按键松开,风扇停止//
int buttonPin =2;     
int fanPin=3; 
int val;
void setup() {
  // put your setup code here, to run once:
   Serial.begin(9600);
   pinMode(buttonPin,INPUT);
   pinMode(fanPin,OUTPUT);
}

void loop() {
   val=digitalRead(buttonPin);
   Serial.print(val);
   if(val==HIGH)
   {
     digitalWrite(fanPin,HIGH);
   }
   else
   {
     digitalWrite(fanPin,LOW);
   }
}

版本历史记录

Version Date Note [+]新增[-]删除[^]修复
V2.0