The FC-51 IR sensor is a compact, active infrared module designed for obstacle avoidance and proximity detection. It operates by emitting a beam of infrared light; if an object is within its path, the light reflects back to a photodiode receiver, triggering a digital output. Core Technical Specifications

const int sensorPin = 2;
const int ledPin = 13;
#define SENSOR_POWER 7
#define SENSOR_OUT 2

void setup() pinMode(sensorPin, INPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600);