New to forum,
School Project - I am looking to use an IR sensor and I am looking for information on how it works. I understand is has something to do with Infra Red being sent out from the sensor but I don't understand how the information is gathered back by the sensor.
Which IR sensor are you talking about?
IR remote stuff:
Lots of different types of IR sensors. Which exact one do you have?
PIR, ToF, brightness, modulated transmission, break beam... just to name a few things you can do with IR.
IR sensors work because they have a filter that stops ALL light, except the IR range they were designed for. Behind the filter is a standard light sensor.
PIR - Passive InfraRed sensors - standard burglar alarm and motion sensing light sensors - have a lens that performs like a flies eye. smooth outside. rows of Fresnel ( Frah - nell ) lenses inside. when an IR heat source moves past, the lenses generate a series of pulses. enough pulses in a short interval causes the sensor to flip a switch momentarily. if they did not incorporate the lenses and pulse counter, the sensor would trip continuously when it saw your neighbors car radiator
PIRs are useless at this time of year in the American southwest. the outside air temperature is body heat temperature. moving past the lenses does not generate pulses
if the lens is yellowed and crumbling, it can't transfer enough IR. the sensor is electronically active but optically inert.
The sensor that I am using is a PIR sensor
what code do i use if im using a simple pir sesnor to turn on led lights?
I'd start with digitalWrite(LEDPIN, digitalRead(PIRPIN)); even though that'd pretty much make the whole Arduino redundant.
the answer is, as happens so often, in the Project Hub.
PIR sensor search in the Project Hub (https://create.arduino.cc/projecthub/search?q=pir+sensor)
can someone please give me a code to use with a pir sensor
the code to use with a pir sensor is in every project in the link above your post. which is why it was linked. you are asking a question which has already been answered