“红外测距传感器(GP2Y0A21)兼容Arduino、Scratch机器人 测距离”参数说明
认证: | ruilongmaker | 适用年龄: | 10岁以上 |
材质: | 塑料 | 型号: |  XH2.54 3Pin |
规格: | 3PIN-30 | 商标: | ruilongmaker |
包装: | 特供包装盒(可订做) | 产量: | 10000 |
“红外测距传感器(GP2Y0A21)兼容Arduino、Scratch机器人 测距离”详细介绍
红外测距传感器(GP2Y0A21),GP2Y0A21是夏普红外距离传感器家族成员之一,此型号可提供80cm的探测距离,属于红外测距中的基础类产品,同样也拥有夏普在红外距离探测领域一贯的品质,其具有一对红外信号发射与接收二极管,发射管发射特定频率的红外信号,接收管接收这种频率的红外信号,当红外的检测方向遇到障碍物时,红外信号反射回来被接收管接收,经过处理之后,通过模拟传感器接口返回到机器人主机,机器人即可利用红外的返回信号来识别周围环境的变化。
电源要求:+4.5 to 5.5 V
静态电流: Typ. 30 mA
信号类型:模拟信号
接口模式:3Pin传感器线
引脚定义:G-地 V-电源 S-模拟电压信号输出
测距范围:10 to 80 cm
模块重量:7g
(1)连线方法:按照传感器模块接口标号与主控制器相连接,标号“G”接主控制器的“地”、“V”接“电源”、“S”接“Arduino UNO R3”A0;
(2)Arduino IDE中复制粘贴以下代码,可以通过串口监视器查看输出的sensorValue,当距离白色墙壁距离变化时,sensorValue会随之变化。
代码:
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int sensorValue = 0; // value read from the pot
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);
delay(2);
}
电源要求:+4.5 to 5.5 V
静态电流: Typ. 30 mA
信号类型:模拟信号
接口模式:3Pin传感器线
引脚定义:G-地 V-电源 S-模拟电压信号输出
测距范围:10 to 80 cm
模块重量:7g
(1)连线方法:按照传感器模块接口标号与主控制器相连接,标号“G”接主控制器的“地”、“V”接“电源”、“S”接“Arduino UNO R3”A0;
(2)Arduino IDE中复制粘贴以下代码,可以通过串口监视器查看输出的sensorValue,当距离白色墙壁距离变化时,sensorValue会随之变化。
代码:
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int sensorValue = 0; // value read from the pot
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);
delay(2);
}