网上淘的E18-D50NK到货了,闲着没事试了一下,顺便做个笔记
就是这货,红色接5V正极,绿色接GND,黄色为信号线
后面的小圆孔可以调节有效检测距离
arduino代码如下:
int E18Pin=8; //定义信号输入口
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(E18Pin,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print(digitalRead(E18Pin));
delay(1);
}
欢迎加群437577621,共同交流学习~