Author Options:

Can somebody help me write a simple arduino program involving a motion sensor? Answered

I have been working on a motion activated version of the mini portal turret from think geek. I am new to arduino, and have no idea where to start when it comes to programming! I have designed the circuit so that the led for the eye and the microcontroller that controls the voice are separate.

My goal is to have a PIR detect the presence of a person, the turret to speak a single phrase, and the led to fade in and out. It will then wait 5 seconds, and if motion is detected, repeat the previous cycle. If no motion is detected, the led will fade out and stay off. 

If somebody could just get me started in the right direction, I would be very grateful!


if your using a parallax pir, then all you would need to do is:
while (digitalRead(pin)=0) {}
//insert rest of code here

where pin is the pin connected to the pir sensor

Look at other projects that involve an Arduino and a PIR sensor. Also go to the Arduino Forums and look around and different projects there. I'm sure someone has already fitted one of those turrets with an Arduino and a PIR.

+1 The forums and learning sections of Arduino.cc are a great place for any Arduino related questions/issues.
Also, this same project appears to be fully detailed HERE or in the side bar to the right ----------->