February 4, 2012
I've got two sets of phototransistors and infrared emitters put together to make two IR distance sensors. They are both connected in the same way, both powered by my Arduino Uno, both with the same resistor, etc. But when I check the values I'm getting from them, one of them ranges from about 980 - 1010, with the higher value closest to the sensor. The other, however, goes from about 350 - 570, with the higher value the furthest from the sensor.
In addition, I have a servo that is supposed to turn based on the the difference between the readings of the two sensors, so as to have motion tracking, or a basic emulation of it. The code is eesentially this:
if (difference between sensors > 0)
else if difference < 0
But it just tutrns to one side and stays, despite the fact that the values are constantly changing.
Can someone pelase help/point me in the right direction?