Hi, I'm using 2 IR receivers to detect an infrared ball. I've been trying to use digitalread or analogread to find that when the ball is being detected I receive a 0 and when it's not I receive a 1 or 1023 depending on the type of read as I'm using the 5V pin to power the receivers. My logic was at first if both sensors (on either side of the robot facing forwards) can detect the ball then the robot should move forward in a while loop as long as it's detecting the ball. Problem is, the receivers work in such way that even if the source is right in front they will show 0 or 0s and the. 1s for a while so I can't use a while loop without the robot stopping every quarter of a second. I spoke to my lecturer who said something about using a resistor and a capacitor and taking the average of the readings and then subtracting the difference between the IR readings and THEN if it's less than 100 move forward but I'm finding it hard to understand how to do this. Could anyone assist me please?
do u have circuit diagram of it. and datasheet of ur IR transmitter and receiver? the problem might be in your analog part (hardware side) it should give 0 when object detected means IR ball will be in Line of sight. right? it should give 1 when object is not detected. means IR ball is not line of sight. right?