Pretty simple, lights up the led light for 15 seconds and then waits for a second to read the sensor again to avoid immediate re-triggering.
As for the circuit, I have connected the two +s of the sensor and the 3W led to two 5V ports on the arduino uno board and of course their two -s to two GND ports. I wanted to ask, will I need any resistors? I have some 1k resistors that came in the starter pack. If so, I will need to make it with a breadboard instead of connecting the modules directly on the arduino board, no?
Also, I plan to power it up with a 9v battery. Any ideas of how to mount it on the wall above/near the door? Any protective case to put it in or something?
What is "the sensor"?
lEDs always need serial resistors.
Use pen and paper to make schematics, not words.
Improving code.... Check up the "Blink without delay" topic. Using delay quickly brings the to a dead end.
Please post a data sheet for the 3W LED. 3W at 5V is 600mA. Way way more than an Arduino output pin can supply. 20mA is the recommended maximum current for an output pin. You will need a driver for the LED. Probably a constant current LED driver.
Like this? Those smoke alarm batteries have little current capability. You will need to determine the actual current requirements of the project and buy the correct battery or power supply.
Perhaps breadboard (solderless) for development, but for a permanent installation I would make a PC board or wire (solder) to a piece of protoboard. Soldering required for secure connections.
For any battery long term power, you'll have to start thinking about how to spend as little energy as possible whilst waiting for motion triggering.
PIR sensors don't use so much power that they can't assume the roll of the controlling element.
You'll sooner or later need to look into sleep modes for the Arduino board, there is no better place than
which is a slog but has everything including complete sketches for various scenarios.
I always advice ppl to read the entire thing like they know what he is talking about… he does a good job and after the Nth pass through it you will be able to steal borrow perfect code for your sitch.
An HC SR501 PIR Motion Sensor. It's a very simple project, I don't need to make schematics on pen and paper. "Using delay quickly brings the to a dead end"...I don't understand what this means.