I have a project to be completed regarding rotating a 12V motor (150 rpm) motor. I want the motor rotation to be controlled by PIR sensor that detect human motion. I have the programming on PIR sensor and motor separately but I have the problem in combining them in one programme. I also want the motor controlled by a L293D motor driver. If possible, I need the circuit connection diagram too.
You have the programming for the motor and the PIR. I think they run. What is the problem running PIR and motor simultaniously? What kind of Arduino board are they connected to?
PIR sensor is on or off.
What is your purpose of using an H-bridge, and an ancient at that? Run the motor either direction based on the PIR? If it's just to switch on/off the motor or control speed in one direction a single MOSFET is simpler, smaller, cheaper and more efficient.
Show us your best attempt at combining your PIR and motor programs and explain what problems you're having. We can't help you with something we've never seen.
Does your best shot work?
If not what does it do?
Can you please describe what you want to happen;
When the PIR detects?
When the PIR stops detecting?
Please read the post at the start of any forum , entitled "How to use this Forum".
OR http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
That program looks like it does something with an LED and a motor via an L298N when a PIR is in a particular state (after it's finished flickering the LED for some time, what's that about?).
That's all you've told us you want. So does that mean your program is working for you now?
If not we need more information about what it is doing or not doing that you want it to do...in detail please.