Sorry but I can't keep up, that's about 4 totally different pieces of code, we still don't know what values the sensor is returning, and now we have complicated floating point maths just (I gather) to turn on a LED/fan when something gets close.

Quote

sending a voltage to the sensor

You are (I assume, still haven't seen a schematic) supplying the sensor with 5v but you aren't "sending" it anything, you are reading the sensor's output.

Quote

And then how do I get it to trigger the lights?

What lights, a minute ago it was a fan. Or do you mean the LED on pin 13?

State the project goals clearly, is it movement or proximity you need to measure? Does the fan/whatever start when X happens and stop 5 seconds later even if X is still happening, or should it start when X happens then stop 5 seconds after X stops. etc etc.

if (sensorValue > TRIG_VAL) {digitalWrite(fanPin, HIGH); delay(5000);digitalWrite(fanPin, LOW); while (analogRead(IRpin) > TRIG_VAL); // now wait for the object to leave before allowing a repeat performance}}

It's based on my reading of the data sheet, the TRIG_VAL should be a value just over the reading you get with nothing in front of the sensor. That's why I wanted to know the values.

This is not very clever code as it stops the processor from doing anything else, but it should do for now.

Note also that the sensor output dives at about 15cm, that will be difficult to deal with because that will look the same as the object moving away really fast.