Explore Labs is the compilation of numerous concepts developed by years of hard work, dedication and expertise in the topics presented so that they are easily grasped by even the most non-technical, non-programmer layman.
int Alert = 2; // Connect Alert!! LED to Digital pin 2
int infraRed = A0; // Infra Red Receiver (Photo Diode) to Analog Pin A0
int x = analogRead(infraRed);
if(x > 1020) // Since Arduino has 10-bit ADC,
// the range of input from IR Rx (Photo Diode) would be between 0 - 1024.
// you will find that when an obstacle is detected,
// the value in Serial Monitor is just close to 1024 (i.e., HIGH).
// It works when both IR Tx and IR Rx (Photo Diode) are upto 6 inches apart.