The sensor is plugged directly into the analog port and I’m using the example java code from here. The website litsts this as a common error, however we are shining it against a flat surface, and there isn’t interference so the proposed solutions from the website don’t apply.
I am not sure if you problem is the same as ours was based on description. But maybe this helps. Our over the bumper intake was well below (20 inches) the sensor so we didn’t suspect the flat surface impacting the reading. However, after some trials, we noticed the reading changed when the arm went out. We fixed it by putting a barrel of duct tape around the sensor to narrow the focus or filter out the flat surface from below. A 3d print shield will be the permanent solution.
Yea we have found that they have a minimum distance that you really can’t do much about, when we used them we had to place them halfway back in our robot and just subtracted out that distance to get an accurate reading. The max distance isn’t all that great either but at least it is something.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.