进阶之路(基础篇)

 1 /*********************************
 2 代码功能:Pulse脉冲宽度测量
 3 使用函数:
 4     pulseIn(引脚号,脉冲响应电平,最大响应时间(微秒));
 5 创作时间:2016*10*08
 6 作者邮箱:jikexianfeng@outlook.com
 7 ********************************/
 8 int keyPin = 2;
 9 void setup()
10 {
11     pinMode(keyPin,INPUT);
12     Serial.begin(9600);
13 }
14 void loop()
15 {
16     unsigned long duration = pulseIn(keyPin,HIGH,60000000);
17     Serial.println(duration);
18 }
原文地址:https://www.cnblogs.com/jikexianfeng/p/6824305.html