Sensor de distancia por infravermelhos, permite detectar distancias de 4cm a 30cm, sendo ideal para detectar objectos na sua proximidade.
O seu preço torna-o bastante apetecível para medidas de pouca precisão, contudo não detecta objectos transparentes, como vidro ou acrílico, por estes serem premiáveis a estas ondas.
(https://lusorobotica.com/proxy.php?request=http%3A%2F%2Fwww.mindsensors.com%2Fimages%2Fpagemaster%2FDIST01PGP3_1.JPG&hash=77ce5d73c979693a1da34aa29ee00d5e6f81d466)
Saída: analógica
Distancia: 4cm to 30cm
Links:
- Datasheet (http://document.sharpsma.com/Handler/getfile_handler3.asp?nodeid=Documents&fileid=94D3FF21D75C4BD6B968B7F0212C8773)
- Informação em SocietyOfRobots (http://www.societyofrobots.com/sensors_sharpirrange.shtml)
Links Relevantes:
- Sensor parecido mas com range de 10cm to 80cm (http://www.lusorobotica.com/viewtopic.php?f=41&t=100)
Código exemplo para o Arduino Diecimila:
/*
Sharp GP2D12 IR ranger reader
Language: Wiring/Arduino
Reads the value from a Sharp GP2D12 IR ranger and sends
it out serially.
*/
int sensorPin = 0; // Analog input pin
int sensorValue = 0; // value read from the pot
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
sensorValue = analogRead(sensorPin); // read the pot value
// the sensor actually gives results that aren't linear.
// this formula converts the results to a linear range.
int range = (6787 / (sensorValue - 3)) - 4;
Serial.println(range, DEC); // print the sensor value
delay(50); // wait 50 milliseconds
// before the next loop
}