int irSensorPin = 2;
int ledPin = 13;
void setup() {
Serial.begin(9600);
pinMode(2, INPUT);
// Set the LED pin as output
pinMode(13, OUTPUT);
}
void loop() {
int sensorValue = digitalRead(2);
Serial.println(sensorValue);
if (sensorValue == LOW) {
digitalWrite(13, HIGH);
Serial.println("Object detected!");
} else {
digitalWrite(13, HIGH);
}
delay(100);
}