Connecting the FC-51 to an Arduino requires only three jumper wires. Because the module outputs a simple digital high/low signal, it can be read using any standard digital input pin. Wiring Diagram Arduino Uno Pin Digital Pin 2 Arduino Source Code
💡
// If sensor reads LOW (object detected) if (sensorValue == LOW) objectDetected = true; digitalWrite(ledPin, HIGH); // Turn LED ON Serial.println("Obstacle Detected!");
Understanding the output logic is crucial for programming. The FC-51 outputs a . By default (most modules), the logic is: