2000元阿里云代金券免费领取,2核4G云服务器仅664元/3年,新老用户都有优惠,立即抢购>>>
阿里云采购季(云主机223元/3年)活动入口:请点击进入>>>,
阿里云学生服务器(9.5元/月)购买入口:请点击进入>>>,
具体讲解
这个比较简单,就是触摸后给个信号
电路连接
在Arduino上将VCC引脚连接到5V。
将GND连接到Arduino的GND。
将OUT连接到Arduino上的D2
代码实现
void setup() {
pinMode(2, INPUT);
Serial.begin(9600);
}
void loop() {
if (digitalRead(2) == HIGH);
Serial.println("Sensor is touched");
delay(500);
}