108个传感器之-微型热释电人体红外传感器(39)

108个传感器之-微型热释电人体红外传感器(39)

介绍

引脚示例

img

引脚连接

pin 引脚连接开发板的 gpio 接口即可:

DEV BOARD Sensor
Pin 2 signal
5 V +V
GND GND

代码示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <Arduino.h>

int pin = 2;
int value;

void setup () {
pinMode(pin, INPUT);
digitalWrite(pin, HIGH);
Serial.begin(9600);
}

void loop () {
value = digitalRead(pin);
if (value == LOW) {
Serial.println("Signal detected!");
delay(100); // 100 ms break
} else {
delay(100); // 10 ms break
Serial.println("No signal detected!");
}
}

小结

待完善…

108个传感器之-微型热释电人体红外传感器(39)

http://blog.jzxer.cn/20250111/20250111-sr312-body-sensor/

作者

dev

发布于

2025-01-11

更新于

2025-01-04

许可协议

评论

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×