I have this IR tx+rx module pair onboard with 3 pins corresponding +5v, Gnd and output. It triggers an output when the infrared light is reflected back from the TX to the RX diode. The output pin is fed to digital pin and I can read it from digitalRead(). This module is similar to the one shown on this: http://exploreembedded.com/wiki/images/thumb/6/6e/IR_Sensor.JPG/680px-IR_Sensor.JPG
I want to make use of this as an obstacle counter, but I'm stuck at the programming, as my program detects and obstacle, but then constantly increments the counter. I'm not adding my code here as I have tried various methods to increment counter and to print it's intermediate values, but I'm not having success.
I intend to count the number of rotations on a wheel which contains one metal strip as an obstacle per circumference of the wheel. But the my program keeps counting the obstacle when the wheel i stopped at the metal strip. (This strip is 2-3mm wide and I may alter it's dimensions to suit my project)
Can someone offer a code for this?