SHARP红外距离传感器,通常作为避障以及路径规划传感器。此型号提供高达150cm的探测距离,是GP2D12的一倍。
技术规格:
探测距离:20-150cm
工作电压:4-5.5V
标准电流消耗:33-50 mA
输出量:模拟量输出,输出电压和探测距离成比例
Arduino测试代码:
int IRpin = 0; // analog pin for reading the IR sensor
void setup() {
Serial.begin(9600); // start the serial port
}
void loop() {
float volts = analogRead(IRpin)*0.0048828125; // value from sensor * (5/1024) - if running 3.3.volts then change 5 to 3.3
float distance = 65*pow(volts, -1.10); // worked out from graph 65 = theretical distance / (1/Volts)S - luckylarry.co.uk
Serial.println(distance); // print the distance
delay(100);
}