New with sensors

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.

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.

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.

EDIT: Make that 5 pieces of code :slight_smile:


Rob