arduino控制雨滴传感器
一、实物连接
二、代码实现
const int analogPin=A0; //the AO of the module attach to A0
const int digitalPin=7; //D0 attach to pin7
const int ledPin=13; //pin 13 built-in led
int Astate=0; //store the value of A0
boolean Dstate=0; //store the value of D0void setup()
{pinMode(ledPin,OUTPUT); //set the ledPin as OUTPUT pinMode(digitalPin,INPUT); //set digitalPin as INPUTSerial.begin(9600); //initialize the serial monitor
}void loop()
{Astate=analogRead(analogPin); //read the value of A0Serial.print("A0: ");Serial.println(Astate); //print the value in the serial monitorDstate=digitalRead(digitalPin); //read the value of D0Serial.print("D0: ");Serial.println(Dstate);if(Dstate==HIGH) {digitalWrite(ledPin,LOW);}else //if the value of D0 is LOW{digitalWrite(ledPin,HIGH); //turn on the led}
}
arduino控制雨滴传感器相关推荐
- arduino控制超声波传感器
一.实物连接 二.代码实现 #include <Wire.h> #include <LiquidCrystal_I2C.h> #include <NewPing.h> ...
- Arduino控制土壤湿度传感器
// 这里定义土壤湿度传感器 int HUMIDITY = 3; // 传感器模拟输入 int HUMIDITYA0 = A0; // 小水泵的继电器 int WATER = 2;void setup ...
- arduino控制声音传感器
一.实物连接 二.代码实现 #include <Servo.h> const int ledPin = 8; //pin13 built-in led const int soundPin ...
- arduino控制光敏传感器
一.实物连接 二.代码实现 const int photocellPin = A0; //photoresistor module attach to A0 const int ledPin = 13 ...
- arduino控制dsb18b20传感器
一.实物连接 二.代码实现 #include <OneWire.h> #include <DallasTemperature.h> #include <LiquidCry ...
- arduino控制颜色传感器
一.实物连接 二.代码实现 #include <TimerOne.h> //the header file #define S0 3 // Please notice the Pin's ...
- arduino控制震动传感器
一.实物连接 二.程序实现 代码如下: const int vibswPin = 8; //the Vibration Switch attach to const int ledPin = 13; ...
- 使用声音传感器的Arduino控制的音乐喷泉
原文:https://circuitdigest.com/microcontroller-projects/arduino-controlled-water-fountain-using-sound- ...
- 【Arduino】温湿度传感器(DHT11)控制设计 四位数码管,LCD1602,带蜂鸣器、LED灯报警,串口输入设定阈值
@[TOC]( [Arduino]温湿度传感器(DHT11)控制设计 四位数码管,LCD1602,带蜂鸣器.LED灯报警,串口输入设定阈值 ) 一.实验器材 UNO控制板:1块 共阳极四位数码管:1个 ...
- Arduino控制GP2D12红外线测距传感器
转自:http://blog.jianghu.taobao.com/u/MTM1NjA0Nzg=/blog/blog_detail.htm?aid=20109580 最近忙生活琐事,很少搞这些小东东, ...
最新文章
- 化工热力学重修补考第三章重点内容
- boost::hana::sum用法的测试程序
- 操作系统各大公司笔试题汇总
- Linux文件命名规则
- springcloud config服务端配置(一)
- 千兆交换机下面可以接多少层交换机_高清监控怎么选配交换机
- Codeforces Round #445 div.2 D. Restoration of string 乱搞
- 【ASP.NET随笔】DataRow和DataRowView
- Material-Animations
- lowagie.text 表格带复杂表头 导出word
- HDU 4289 Control (最大流最小割)
- html img动态设置图片大小,Js动态设置Img大小
- lol服务器维护2021,lol维护公告最新时间2021什么时候结束 11.11版本5月27日更新内容介绍...
- C盘数据丢失恢复详解和注意事项
- 生死看淡,不服就GAN(九)----英伟达力作PGGAN实战,生成高清图片
- maya arnold自定义aov分层灯光组添加方法
- Java解析word文档,将word文档题库选择题导入
- html中js正则表达式手机,js验证电话号码与手机支持+86的正则表达式
- 【转】.NET引用Excel操作时无法关闭Excel.exe进程的解决方法
- 利用ARCHPR明文攻击对zip口令进行破解以及报错解决
热门文章
- gentoo中文文档
- 会话描述协议-SDP
- mysql学生管理系统背景_学生基本系统管理
- 基于python的学生管理系统的设计开题报告_学生信息管理系统_毕业设计论文_开题报告...
- 能源消耗总量计算公式_七、能源统计(21)
- 红包小游戏php源码,H5抢红包 小游戏源码
- c语言食堂饭卡管理课程设计,第十一章 C语言课程设计—饭卡管理程序.docx
- Matlab R2008a破解
- Cesium中的Heading/Pitch/Roll
- 爬取qq音乐,js加密sign值无效,包含思路,遇到的各种问题要点