Go Down

Topic: Sharp gp2d120 (Read 916 times) previous topic - next topic

TheVerse

Hi I have been testing my Sharp gp2d120 sensor with this code

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println(analogRead(0));
  delay(100);
}


all I am getting in the serial monitor is 228-229, no matter how much I move an object to and fro from the sensor the number doesnt change


johnwasser

The software looks right so the problem is probably in hardware.  Check your wiring.  Get a multimeter and check the voltage output of the sensor to see if it changes properly (connect to Gnd, +5, and meter between the signal line and Ground).  Try a different analog input pin (perhaps A0 has been damaged).
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

TheVerse

checked all of that and still the readings arent changing :-/

johnwasser

So the meter is showing a changing output and none of the Arduino analog inputs shows the changing output?  Sounds like a fried ATmega chip.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up