Improving Maxsonar Sensor

Hi all.

I've been working on a project that uses a maxsonar sensor. But, right now, I'm just looking at the analog reads (i.e. printing out the measured distances in the serial port). I'm running the analog portion of this code. When I run the digital one, it prints out 0 inches each time.

I was wondering if anyone can shed light on why my maxsonar would produce the same (or nearly the same) read each time, regardless of distance of other people/objects? The reads are almost always 260in, and occassionally 259in.

I started troubleshooting the sensor. I think there is an electrical or mechancial issue, but the images at the link are broken, so I'm not sure how to resolve it.

Any ideas would be so appreciated!

ETA - I was getting unstable reads before but I just realized it's because I left out a line of code, so that's fixed.

The best way to troubleshoot the sensor is to look at the raw readings instead of some averaged readings. Try this code:

void setup() {

void loop() {