Same result...
I've added a 12K Resistor (10K+1K+1K - Because I don't got a 12K) - to the Vo - this was missing when I've tried...
I've also added the code you've mentioned (see new code below)
int distpin = 7;
int val = 0;
void setup()
{
pinMode(distpin, INPUT);
digitalWrite(distpin, HIGH);
Serial.begin(9600);
delay(50);
}
void loop()
{
int val = digitalRead(distpin);
Serial.println(val);
delay(500);
}
If I look at the serial monitor I only see 1,1,1 But - no 0 - not matter what distance - this is why I've set the input to HIGH - right?
Before posting i was looking at some example code and read the values with analoge in - where i can see that the sensor(s)'s working (0,9 Volts or less - depending on the distance) - so the sensor should work.
I've also bought a second sensor - which will be needed in future - and get the same results so the possibility, that the sensor is damage is very low...
The LED with a 220 Ohm resistor does'nt blink or anything...
A closer view of the cabeling:
http://fritzing.org/projects/distance-sensor-sharp-gp2d150a/Thx for any help...
Bjoern