const int irPin = A0;
void setup() {
Serial.begin(9600);
pinMode(irPin, INPUT);
}
void loop() {
int irValue = analogRead(irPin);
float voltage = irValue * (5.0 / 1023.0);
if(voltage <= 3) {
Serial.println("Object detected");
}
else {
Serial.println("Object not detected");
}
}